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

2 Likes


Related Questions