Programming Languages C Objective
Mar 08, 2013

What will be output of following c code?

#include<stdio.h>

int main(){

    int i;

    for(i=10;i<=15;i++){

         while(i){

             do{

                 printf("%d ",1);

                 if(i>>1)

                      continue;

             }while(0);

             break;

         }

   }

    return 0;

}

Choose the correct answer:
A) 1 1 1
B) 1 1
C) 1 1 1 1 1 1
D) 1 1 1 1 1 1 1
Detailed Explanation

For loop will execute six times.

Note: continue keyword in do-while loop bring the program its while condition (while(0)) which is always false.

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback