WAP To Print First n Natural No. And Their Sum.

#include<iostream.h>
#include<conio.h>
Void main()
{   int i,sum,n;
    cout<<”Enter the no.:”;
    cin>>n;
    for(i=1;sum=0;i<=n;++i)
    {    cout<<”\n”<<I;
          sum=sum+I;
     }
     cout<<”\n”<<”The sum of first”<<n<<”natural no. is:”<<sum<<”\n”;
     getch();

  }

Comments

Popular Posts