Robotics & Artificial Intelligence
Write Python code to find the sum of the given series:
1 + (1*2) + (1*2*3) + …………… + (1*2*3*……………*n)
Python Control Flow
3 Likes
Answer
n = int(input("Enter the value of n: "))
s = 0
p = 1
for i in range(1, n+1):
p = p * i
s = s + p
print("Sum of the series =", s)Output
Enter the value of n: 5
Sum of the series = 153
Answered By
1 Like
Related Questions
Design Python code to find and display the sum of the following series:
s = (1*2) + (2*3) + …………… + (19*20)
Write Python code to find the sum of the given series:
1 + (1+2) + (1+2+3) + …………… + (1+2+3+……………+n)
Write Python code to find the sum of the given series:
S = 1! + 2! + 3! + 4! + …………… + n!
[Hint: Factorial of 5! = 5*4*3*2*1]
Write a program to find and display the sum of any ten natural numbers.