March 06, 2021

perfect number program using python

 perfect number program using python

Perfect number, a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8,128.












source code

# enter number is perfect or not 

num = int (input("enter the number : "))

add=0
for i in range (1,num):
if(num%i==0):
add=add+i

if num==add:
print(f"{num} is profect number ")
else:
print (f"{num} is not profect number ")








No comments:

Post a Comment

find the cube of the range given digits. || codeAj

Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...