Answer to Question #57640 in C++ for Sajid 2
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
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment