Python Program to print the sum of factors of a number
Python Program to print the sum of factors of a number
What is the Factor of a number?
A number a
is said to be a factor of b
if
b%a=0
Python Program to print sum of factors of a number
# Program to find the sum of factors of a number
n = int(input("Enter number"))
def sum_ (n):
s=0
for i in range(1,n+1):
if n%i==0 :
s += i
return s
print('sum: ' + str(sum_(n)))