How do i print the interim result instead of one result | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i print the interim result instead of one result

for(i=0;i<5;i++) { x*=i

2nd Jan 2017, 12:40 PM
tolga
5 Answers
+ 6
You may have to elaborate a tad on your question. By interim result, do you mean the consecutive values of x for each loop?
2nd Jan 2017, 12:49 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
You print the value of x for each run in the loop. for(i=0;i<5;i++) { cout << x << endl; x*=i; } cout << x << endl;
2nd Jan 2017, 1:25 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
for(i=0;i<5;i++) { cout<<x*=i; }
2nd Jan 2017, 1:40 PM
Iván
Iván - avatar
0
Yes
2nd Jan 2017, 12:50 PM
tolga
0
sa bende c++ üzerinde çalısıyorum tecrübeliysen bana yardımcı olurmusun telefon no :0545 587 29 30
28th Jan 2017, 7:51 AM
Ömer Yenitürk
Ömer Yenitürk - avatar