Informatics Practices
WAP to display the sum of the given series:
Sum = 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3…..n)
Python Control Flow
8 Likes
Answer
n = int(input("Enter the value of n: "))
sum = 0
for i in range(1, n + 1):
for j in range(1, i + 1):
sum += j
print("The sum of the series is:", sum)Output
Enter the value of n: 4
The sum of the series is: 20
Answered By
2 Likes
Related Questions
WAP to print the sum of the series 1 - x1/2! + x2/3! - x3/4! …………… xn/(n + 1)! — exponential series.
WAP to print the sum of the series 1 - x2/4! + x3/6! - x4/8! + x5/10! …………… xn/(2n)! — exponential series.
WAP to print the following pattern:
* * * * * * * * * * * * * * *WAP to print the following pattern:
A B B C C C D D D D E E E E E