Wednesday, December 9, 2009
c programming questions and answers
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);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment