Advertisement
immanual1

2f

Jan 13th, 2025
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. def sum_of_products(n1, n2):
  2. sum = 0
  3. for i in range(1, n1 + 1):
  4. sum += i * (i + 1)
  5. return sum
  6.  
  7. n1 = int(input("Enter the value of n1: "))
  8. n2 = int(input("Enter the value of n2: "))
  9. sum = sum_of_products(n1, n2)
  10. print("Sum of the series:", sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement