Docsity

python programming for series calculation 1+3+n., Assignments of Computer Programming

Toggle sidebar
bg1
Python Program to Find Sum of Series
1²+2²+3²+….+n²
Program:
n = int(input("Enter Positive Number : "))
sum = 0
sum= (n*(n+1)*(2*n + 1))/6
print("The Sum of Series is",sum)
Output:
Enter Positive Number : 5
The Sum of Series is 55.0
Python Program to Find Sum of Series
1²+2²+3²+….+99²
n = 99
sum = 0
sum= (n*(n+1)*(2*n + 1))/6
print("The Sum of Series is",sum)
Output:
The Sum of Series is 328350.0
pf2

Partial preview of the text

Download python programming for series calculation 1+3+n. and more Assignments Computer Programming in PDF only on Docsity!

Python Program to Find Sum of Series

1²+2²+3²+….+n²

Program: n = int(input("Enter Positive Number : ")) sum = 0 sum= (n(n+1)(2*n + 1))/ print("The Sum of Series is",sum) Output: Enter Positive Number : 5 The Sum of Series is 55.

Python Program to Find Sum of Series

n = 99 sum = 0 sum= (n(n+1)(2*n + 1))/ print("The Sum of Series is",sum) Output: The Sum of Series is 328350.