#include<stdio.h>
#include<math.h>
int main()
{
int n,i,a,d,e=5;
scanf("%d",&n);
printf("%d ",e);
for(i=2;i<=n;i++)
{
d=pow(i,2);
a=e+d;
printf("%d ",a);
e=a;
}
return(0);
}
Sample Input :
7
Sample Output :
5 9 18 34 59 95 144
7
Sample Output :
5 9 18 34 59 95 144
No comments:
Post a Comment