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 ?
2 Answers
+ 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.
+ 2
thx bro.