-
On executing the following program how many times will the message "Thanks God" get printed?
#include <stdio.h>
int main ( )
{
int a;
for(a = -1; a <= 10; a++)
{
if (a < 5)
continue;
else
break;
printf(" Thanks God\n");
}
return 0;
}
-
- Infinite times
- 11 times
- 0 times
- Once
- 10 times
Correct Option: C
For value a less than 5 it won't print anything, and for any value greater than this loop will break. So thanks good will never be printed.