+ 1
Can someone explain this
#include <iostream> using namespace std; int main (){ int x=1; for(;x<6;x+=2){ x=x*x; } cout<<x; }
3 Respuestas
+ 22
1*1=1 //First run
1+2=3 //Increment after run
// check whether 3<6?
3*3=9 //Second run
9+2=11 //Increment after run
// check whether 11<6?
out of loop..
print
+ 18
11
+ 1
That is the logic in S!d answer! What more do you want?