Python Program to input any number and check whether it is perfect number or not


n = int(input ('Enter a no.'))

sum = 0

n1=n

for i in range (1,n):

    if (n%i==0):

        sum = sum + i

if (sum ==n1):

    print (n1,' is a perfect no.')

else :

    print (n1,' is not a perfect no.')

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.