0
explain output
can somebody explain why this outputs as 12?: int f=1, i=2; while(++i<5) { f*=i; } cout<<f; thanks!
3 Answers
+ 3
Yes, you're right ;)
0
ah i think i understand now, but please feel free to correct me if this reasoning is wrong
i increments to 3
3*1 = 3
i increments to 4
3*4 = 12
and then it terminates bc i would no longer be <5
- 2
à€Šà€żà€ à€à€ à€à„à€Ą à€à„à€à€Ąà€Œà„ à€à€Ÿ à€à€à€à€Șà„à€ à€à„à€Żà€Ÿ à€čà„
int f=1, i=2;
while(++i<5)
f*=i;
cout<<f;