**Sum of 1^2 + 2^2 + …. + n^2 series in c programming language**

#include<stdio.h>

int main(){

int n,i;

int sum=0;

printf("Enter
the n i.e. max values of series: ");

scanf("%d",&n);

sum
= (n * (n + 1) * (2 * n + 1 )) / 6;

printf("Sum of
the series : ");

for(i
=1;i<=n;i++){

if (i != n)

printf("%d^2 +
",i);

else

printf("%d^2 =
%d ",i,sum);

}

return 0;

}

**Sample output:**

Enter the n i.e. max values
of series: 5

Sum of the series: 1^2 + 2^2
+ 3^2 + 4^2 + 5^2 = 55

**Mathematical Formula:**

Sum of the series 1

^{2}+ 2^{2}+ 3^{2}+ … + n^{2}=
n (n+1) (2n+1)/6

6. Write a c program to find out the sum of given H.P.

## 23 comments:

thanks...............

Help me

Write a C or Java program to find out the sum of series:

1! + 2! + 3! + . . . + N, with N input from keyboard

thank you :)

1/x+1/x^2+1/x^3+.....

Very good..

Dear sir, Can you have me to write total sum of 2^2+10^2+20^2+50^2+100^2 in java??

1^2+3^2+5^2....................nth find out sum use for loop in c

plz........ any one help me.........

#include

int main()

{

int n,sum=0,i;

printf("Please Enter Number:");

scanf("%d",&n);

for(i=0;i<=n;i++)

{

sum=(sum+i*i);

}

printf("%d",sum);

return 0;

}

please solutionthis program in C++ to generate the series as 1, 3, 4, 8, 15, 27, 50, ........

please solution this program in C++ to generate the series as 1, 3, 4, 8, 15, 27, 50, ........

#include

int main()

{

int n,sum=0,i;

printf("Please Enter Number:");

scanf("%d",&n);

for(i=1;i<=n;i=i+2)

{

sum=(sum+i*i);

}

printf("%d",sum);

return 0;

}

1^2+2^4+3^6+4^8+.............+n^2n for loop c programming code please ans me

your program didn't work. I did a little modification and now it works..

#include

int main()

{

int n,sum=1,i, j=0;

printf("Please Enter Number:");

scanf("%d",&n);

for(i=1;i<=n; i++)

{

sum=(sum+(j*j));

j=j+2;

}

printf("%d",sum);

return 0;

}

1^2+2^2+n^2 /n^2 en c++ como quedaría me dijeron que fuera dando los pasos

que libreria metiste para que funcionara el programa

please help me with this series c programing

2^2+4^4+......n^n

can u help me to write a program in c to print the series

2, 6, 11, 10, 15, 21, 18, 24, 31, 26, 33, 41 .....answer me as much as possibel

Write flowchart and program to read value for x and print the series 3*x^2, 5*x^2, 7*x^2.... 25th terms

plz write the c code

2,6,15,28,55,78

1*2=2

2*3=6

3*5=15

4*7=28

5*11=55

6*13=78.

Plx sir

How can i solve the pyramid through this coding plx i want help its my assignment...

Like

0

101

21012

3210123

432101234

54321012345

Exactly like this

Post a Comment