Advertisement
immanual1

2b

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