Answers for "perfect number program in python"

0

perfect number in python

def perfect_number(n):
    sum = 0
    for x in range(1, n):
        if n % x == 0:
            sum += x
    return sum == n
print(perfect_number(6))
Posted by: Guest on March-07-2021
0

perfect number program in python

n = int(input("Enter any number: "))sum1 = 0for i in range(1, n):if(n % i == 0):sum1 = sum1 + iif (sum1 == n):print("The number is a Perfect number!")else:print("The number is not a Perfect number!")
Posted by: Guest on October-05-2021

Code answers related to "perfect number program in python"

Python Answers by Framework

Browse Popular Code Answers by Language