maynul67

sum of square of all numbers upto n

Jul 10th, 2021
738
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def square_series(n):
  2.     sum = 0
  3.     while n >= 0:
  4.         sum = sum + n**2
  5.         n = n - 1
  6.     return sum
  7. sum = square_series(int(input("Enter number n : ")))
  8. print("Sum of 0²+1²+......+n² is:",sum)
RAW Paste Data