Here is C++ Coding
----------------------------------------------------------------
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int sum,i,j,lim;
cout<<"ENTER THE LIMIT";
cin>>lim;
for(i=1; i<=lim; i++) //for loop execution
{
cout<<"1";
sum=1;
for(j=2; j<=i; j++) // again for loop execution
{
cout<<"+"<<j;
sum=sum+j;
}
cout<<"="<<sum<<endl;
}
cout<<endl;
system("pause");
return 0;
}
=================================
output of this programe is :
0 comments:
Post a Comment