Int x=0; For (int i=0; i <8; i++) { x=i*i; } what will be the output ; and what will be the value of( i) after the for loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Int x=0; For (int i=0; i <8; i++) { x=i*i; } what will be the output ; and what will be the value of( i) after the for loop

9th Feb 2017, 7:20 PM
Sultan
Sultan - avatar
2 Answers
+ 3
there is no output. and i is out of scope after the loop, but it's 8 after the last iteration.
9th Feb 2017, 7:26 PM
Mario L.
Mario L. - avatar
+ 2
x will be 7*7=49 outside the block of "for" i is undeclared.
9th Feb 2017, 7:25 PM
K.C. Leung
K.C. Leung - avatar