write python recursive code to computer and print sum of square of n number. value of n is passed as parameter.
Answers
Answered by
7
Answer:
def sum(n):
if(n==0):
return 0
else:
return (n*n)+sum(n-1)
a=sum(int(input()))
print(a)
Explanation:
Answered by
0
Python recursive code to print the sum of the square of n number.
def square_sum (num):
if num == 1:
return 1
else:
return num * num + square_sum (num-1)
num = int (input ("Enter the number: "))
print ("The sum of square of the entered number is: ", square_sum (num))
In the above program, "num" is the input number passed as a parameter.
#SPJ3
Similar questions