Thursday, February 2, 2012

SUM OF SQUARES OF THE SERIES 12+22+32+--------+n2


#include<stdio.h>
#include<conio.h>

void main()
{
  long int r;
  clrscr();
  printf("\nEnter the range: ");
  scanf("%ld",&r);
  printf("\nSum of the squares of the series is: %ld",((r*(r+1))*(2*r+1))/6);
  getch();
}

2 comments: