0

Help me complete with this output :x

what is the code when the ouput is like this : _______________________________ enter your first number = //ex: 2 enter your last number = // ex: 6 the answer is : 2 + 3 + 4 + 5 + 6 = 20 -------------------------------- i can make output 2-6, but can't make the calculation. Any suggestion ?

4th Dec 2017, 11:49 AM
muwa00.dat
muwa00.dat - avatar
2 ответов
+ 5
int start, end, sum = 0; cin>>start>>end; for(int i=start;i<=end;i++) { cout<<i<<"+"; sum+=i; } cout<<"="<<sum<<endl; // Add other required cout operations yourself.
4th Dec 2017, 11:54 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
thx bro.
4th Dec 2017, 5:10 PM
muwa00.dat
muwa00.dat - avatar