+ 9
Output of this fragment of code. Explain the the output how it works , what could be answer.
int i=0; for(;i<=5;i+=4); {i=i*i;} printf("%d",i);
4 odpowiedzi
+ 2
i<=5
i first equals 0 so for loop is entered
i = 0 * 0
i += 4
i now equals 4, still less than 5 loop again
i = 4 * 4
i equals 16
I += 4, i now equals 20, greater than 5 loop exits
printf("%d", i) output value of i 20
+ 6
Thank you , i was looking for this thing.
+ 5
It is producing output as 20,,,, how????
+ 2
That code won't compile, it has a few errors.
1 semicolon after closing parentheses of for statement.
2 lack of semicolon after last i in code block
3 improper use of print %
See code below
#include <stdio.h>
int main() {
int i=0;
for(;i<=5;i+=4) {
i=i*i;
}
printf("%d",i);
return 0;
}