Code Box
------------------------------------------------
/*program to calculate sum of the series
(1*1)+(2*2)+(3*3)+(4*4)+.......+(n*n).
Square number series.
by using power function.
where n is the limit entered by user.
*/
#include<stdio.h>
#include<conio.h>
#include<math.h> //for power function
void main()
{
int i,sum,num;
clrscr();
sum=0;
printf("\nEnter limit : ");
scanf("%d",&num);
printf("\nSquare Number Series ");
printf("\nSeries= ");
i=1; //initialization
while(i<=num)
{
sum=sum+pow(i,2); //power function
printf("+ (%d*%d)",i,i);
i++; //increment post fix operator
}
printf("\n\nSum of series= %d",sum);
getch();
}