Robotics & Artificial Intelligence
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]
Python Control Flow
3 Likes
Answer
n = int(input("Enter the value of n: "))
s = 0
f = 1
for i in range(1, n+1):
f = f * i
s = s + f
print("Sum of the series =", s)Output
Enter the value of n: 6
Sum of the series = 873
Answered By
3 Likes
Related Questions
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:
1 + (1*2) + (1*2*3) + …………… + (1*2*3*……………*n)
Write a program to find and display the sum of any ten natural numbers.
Write a program to input any 20 numbers (including positive and negative). The program displays the sum of all positive numbers and negative numbers separately.