===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
long i,n,N,sum;
cout<<"\nEnter number: ";
cin>>n;
cout<<"\n\n\n";
for(i=1,sum=0,N=0;i<=n;i++)
{
N=i;
sum=sum+i;
if(N<=n-1)
cout<<N<<"+";
else if(N==n)
cout<<N<<"=";
}
cout<<sum;
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
long i,n,N,sum;
cout<<"\nEnter number: ";
cin>>n;
cout<<"\n\n\n";
for(i=1,sum=0,N=0;i<=n;i++)
{
N=i;
sum=sum+i;
if(N<=n-1)
cout<<N<<"+";
else if(N==n)
cout<<N<<"=";
}
cout<<sum;
getch();
}
===========================================================================
No comments:
Post a Comment