C
Programming and Technical
Category
main()
{ for(i=0; i++; i<100)
printf("hello world"); }
a)100 times
b)0 times
c)Infinite loop
d)None of the above.
Read Solution (Total 14)
-
- option is d) none of the above .
because there is an error because i is not declared.
but if you declared the answer will be 0 times - 7 years agoHelpfull: Yes(7) No(1)
- b) 0 times, since i++ is post increment and at position of i++ condition is checked but since i is 0 so condition is unsatisfied hence loop breaks without printing anything
- 7 years agoHelpfull: Yes(6) No(2)
- option D
answer is 99
hello world will be printed 99 times. - 7 years agoHelpfull: Yes(1) No(2)
- Infinite loop
- 7 years agoHelpfull: Yes(0) No(3)
- The working of for loop is like :after initialization i=0;the condition part i++ is checked and being post increment its value is i++=0,since condition is false control comes out of loop and nothing is printed
- 7 years agoHelpfull: Yes(0) No(1)
- i value is assigned to 0 and i
- 7 years agoHelpfull: Yes(0) No(1)
- option c is the correct answer.because they didn't gave the condition properly.So it assumes there is no condition so it will fall into infinite loop
- 7 years agoHelpfull: Yes(0) No(1)
- i variable should be declared before initialization.Hence it shows compilation error. If declared and this loop will not display output. i.e 0 times
- 7 years agoHelpfull: Yes(0) No(1)
- D none of the above it returns 99 because if we user for loop
1=0;i++;i - 7 years agoHelpfull: Yes(0) No(1)
- None of the above.
- 7 years agoHelpfull: Yes(0) No(0)
- none of the above....bcz compilation fails...
- 7 years agoHelpfull: Yes(0) No(0)
- 100 times
as first time for i=0 and 99times when i=99
so total 100 times - 7 years agoHelpfull: Yes(0) No(0)
- 100 times
- 7 years agoHelpfull: Yes(0) No(0)
- option-D
because in for loop there is syntax error
correct syntax is := for(i=0;i - 7 years agoHelpfull: Yes(0) No(0)
C Other Question