-
Which of the following is the correct output for the program given below?
#include <stdio.h>
int main ( )
{
int k = 5;
while(k-->=0) printf("%d",k);
i = 5;
printf ("\n");
while(k-->=0) printf("%d",k);
printf ("\n");
while(k-->=0) printf("%d",k);
printf("\n");
return 0;
}
-
- 4 3 2 1 0 -1
4 3 2 1 0 -1 - 5 4 3 2 1 0
5 4 3 2 1 0 - Error
- 5 4 3 2 1 0
5 4 3 2 1 0
5 4 3 2 1 0
- 4 3 2 1 0 -1
Correct Option: A
Only first and 2nd loop will be executing here
So output will be.
4 3 2 1 0 -1
4 3 2 1 0 -1