🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

C प्रोग्राम का आउटपुट क्या है?

What is the output of C Program ?

int main()
{
  int k=10;
while(k <= 12)
{
     printf("%d ", k);
     k++;
}
return 0;
}

A
10 10 10
B
12 12 12
C
10 11 12
D
12 11 10
Explanation

Let's analyze the given C program step by step:

Code:

int main() {
  int k = 10;
  while (k <= 12) {
     printf("%d ", k);
     k++;
  }
  return 0;
}

Explanation:

  • Initialization: The variable k is initialized to 10.
  • The while loop runs as long as k <= 12. It will print the value of k and then increment k after each iteration.
  • The loop executes three times with k taking values 10, 11, and 12.

Iterations:

  1. First iteration: k = 10, it prints "10 ", and then k++ makes k = 11.
  2. Second iteration: k = 11, it prints "11 ", and then k++ makes k = 12.
  3. Third iteration: k = 12, it prints "12 ", and then k++ makes k = 13. The condition k <= 12 is no longer true, so the loop stops.

Output:

The program will print: "10 11 12"

So, the correct answer is:

(C) 10 11 12.

Correct Answer: C) 10 11 12

Latest Updates