Friday, November 20, 2009

C question and answer with explanation









31. SUM OF SQUARES OF THE SERIES 12+22+32+--------+n2
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();
}
32. SUM OF CUBES OF THE SERIES 13+23+33+---------+n3
void main()
{
int r;
clrscr();
printf("\nEnter the number range: ");
scanf("%d",&r);
printf

No comments:

Post a Comment