Se citeste un numar natural nenul n. Sa se se calculeze urmatoarele sume:
a) s = 1+2+..+n
b) s = 1^2 + 2^2 + ... + n^2
c) s = 1^3 + 2^3 + ... + n^3
d) s = 1*2 + 2*3 + .. + n*(n+1)

#include<iostream.h>
void main()
{
int n,s1=0,s2=0,s3=0,s4=0,i;
cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
s1=s1+i;
cout<<s1<<endl;
for(i=1;i<=n;i++)
s2=s2+i*i;
cout<<s2<<endl;
for(i=1;i<=n;i++)
s3=s3+i*i*i;
cout<<s3<<endl;
for(i=1;i<=n;i++)
s4=s4+i*(i+1);
cout<<s4;
}