C++
Programming and Technical
Programming
Program
What will be the output of following program?
main()
{
int i=1;
for(;i<=32768;i++)
printf("%d",i);
}
Options
1) 32767
2) infinite loop
3) 32768
4) None of the above
Read Solution (Total 2)
-
- Infinite loop
- 7 years agoHelpfull: Yes(0) No(0)
- 2) Infinite loop
After i reaches 32767, i++ will make i as -32768. Hence it will never become greater than 32768 and there will be infinite loop. - 7 years agoHelpfull: Yes(0) No(0)
C++ Other Question