Program of sum of squares of n numbers
#include<iostream>
using
namespace std;
int
main()
{
long
int sum=0;
int
n,i;
cout<<"\n
enter the number: ";
cin>>n;
for(i=1;i<=n;i++)
{
sum=sum+i*i;
}
cout<<"\n
sum of squares of first "<<n<<" numbers is
"<<sum;
}
Comments
Post a Comment