# Sum of Square Series

In this post I will show you how to write a Python program to calculate sum of series 1²+2²+3²+….+n².

The following is the mathematical formula for Sum of series:

1²+2²+3²+….+n² = ( n (n+1) (2n+1)) / 6. |

# #**Program to calculate sum of series 1²+2²+3²+….+n² by using the above formula.**

**Output**

Enter any Positive Number : 7
The Sum of Series upto 7 = 140.0 |

**Calculation**

num=7
sum = (num * (num + 1) * (2 * num + 1)) / 6 sum=(7 * (7 + 1) * (2 * 7 +1)) / 6 sum=140.0 |

**# Program to calculate Sum of Series 1²+2²+3²+….+n² for loop.**

Output

Enter any Positive Number : 7
1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 = 140.0 |

**#Python Program to calculate Sum of Series 1²+2²+3²+….+n² using functions**

**Output**

Enter any Positive Number : 7
1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 = 140.0 |