#include <iostream>
using namespace std;
void main()
{
int j, sum = 0;
cout<<"The first 10 natural number is :\n";
for (j = 1; j <= 10; j++)
{
sum = sum + j;
cout<<j<<endl;
}
cout<<"The Sum is :"<< sum<<endl;
system("pause");
}
using namespace std;
void main()
{
int j, sum = 0;
cout<<"The first 10 natural number is :\n";
for (j = 1; j <= 10; j++)
{
sum = sum + j;
cout<<j<<endl;
}
cout<<"The Sum is :"<< sum<<endl;
system("pause");
}
C++ program to find the sum of first 10 natural numbers
Reviewed by Unknown
on
May 18, 2017
Rating:
No comments: