ExamVeda
Login
Home
This question belongs to C Program Control Structures
Control Structures
?

What is the right choice, if the following loop is implemented?
void main()
{
   int num = 0;
   do{
      --num;
      printf("%d", num);
   }while( ++num >= 0 );
}

Answer & Solution
Correct Answer: Option D

As the value of num is decremented(--num) and again incremented(++num) and hence no change in num and it remains 0 only causing infinite loop.

Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Merazur Rahaman
Merazur Rahaman 5 years ago
The Out put will be -1 for infinite times