How does this output 20? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does this output 20?

int i=0; for(;i<5; i+=4)i=i*i; printf("%d", i);

16th Sep 2021, 8:05 AM
Kashyap Kumar
Kashyap Kumar - avatar
1 Answer
+ 2
for i = 0; i=0*0 = 0; i+=4 = 4; 4<5 => True for i = 4; i=4*4 = 16; i+=4 = 20; 20<5 => False
16th Sep 2021, 8:09 AM
Abhay
Abhay - avatar