Advertisement
immanual1

2h

Jan 13th, 2025
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. def sum_of_arithmetic_series(a, d, n):
  2. return (n / 2) * (2 * a + (n - 1) * d)
  3.  
  4. a = 1 # First term
  5. d = 4 # Common difference
  6. n = int(input("Enter the value of N: "))
  7. sum = sum_of_arithmetic_series(a, d, n)
  8. print("Sum of the series:", sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement