#include <stdio.h>
int main()
{
int i;
for (i = 1; i != 10; i += 2)
printf(" GeeksQuiz ");
return 0;
}
Answer: B
Correct answer: GeeksQuiz GeeksQuiz GeeksQuiz .... infinite times
i starts at 1 and rises by 2, so it takes only the odd values 1, 3, 5, 7, 9, 11, … and never equals 10. The test i != 10 is therefore never false. This is why < is safer than != in a loop condition whose variable moves by more than one.
Please log in or register to report this question.