0
Why is the answer 12?
int f=1, i=2; while(++i<5) { f*=i; } cout<<f; Can someone explain to me why the answer is 12? I thought that it would be 2 because you are basically multiplying f from i (1*2), as long as it is below 5.
1 Antwort
+ 3
You add 1 too i in the begining of the loop. So i Will be 3 and 4. Last loop Will be 3*4=12