C
Programming and Technical
Programming
Program
What will be the output of the program?
#include
int main()
{
int i=0;
for(; i<=5; i++);
printf("%d", i);
return 0;
}
Optons
1) 0, 1, 2, 3, 4, 5
2) 5
3) 1, 2, 3, 4
4) 6
Read Solution (Total 3)
-
- option 4)6
The semicolon at the end of for loop indicates that"There is no statement within the for loop".
initially i=0
for each iteration i will be incremented as 0,1,2,3,4,5 and when i value becomes 6,the condition fails.for loop condition fails,so it just print 6.
- 8 years agoHelpfull: Yes(5) No(0)
- Answer: 4
Actually printf is outside the loop becuse it prints 6 only - 8 years agoHelpfull: Yes(1) No(0)
- 0,1,2,3,4,5
- 5 years agoHelpfull: Yes(0) No(3)
C Other Question