CBSE Class 11 Computer Science
Question 66 of 80
Conditional and Looping Constructs — Question 36
Back to all questions 36
Question WAP to display the sum of the given series:
Sum = 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3.....n)
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)Enter the value of n: 4
The sum of the series is: 20