Answer to Question #57640 in C++ for Sajid 2

Question #57640
Q. Write a program to display the following formate using while loop:
Num sum
1 1
2 3
3 6
4 10
5 15
1
Expert's answer
2016-02-08T07:36:54-0500

Solution

#include <iostream>
using namespace std;
void main()
{
int sum=0;
for(int i=1;i<=5;i++)
{
sum+=i;
cout<<i<<' '<<sum<<endl;
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS