#include<iostream>
using namespace std;
int main()
{
int i,n,sum=0;
cout<<"Input the number of terms:";
cin>>n;
cout<<"the squqre natural number are:"<<n<<endl;
for(i=1;i<=n;i++)
{
cout<<i*i;
sum=sum+i*i;
cout<<endl;
}
cout<<"the sum is:"<<sum<<endl;
cout<<endl;
}
No comments:
Post a Comment