Quiz-7


What is the output of the following code:

#include<stdio.h>
int main()
{
        int i=5;
        while(i<10)
        {
              printf("%d ",i);
              if(i==7)
              {
                   while(1)
                   {
                         printf("K ");
                         i++;
                         if(i==9)
                            break;
                   }
              }
              else printf("%d ",++i);
        }
        return 0;
}

Choices:

1) Compile error or execution stops.
2) 5 6 6 7 K K 9
3) 5 6 6 7 7 K K 9
4) 5 6 6 7  7 K K 9 10
5)None of the above(If your choice is 5, then provide your answer and explanation).
 
Answer is posted on our Facebook fan page  here 

No comments: