In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3, and 1 + 2 + 3 = 6, so 6 is a perfect number.
def perfectnumber(numbr): s=0 i=1 while(i<=10000): temp=numbr%i if(temp==0 and i!=numbr): s+=i i+=1 if(s==numbr): return 1 else: return 0 numbr=int(input('Enter a Number : ')) if(perfectnumber(numbr)==1): print("The number is a perfect number") else: print("The number is not a perfect number")
exec.on linux terminal
![](https://www.fcukthecode.com/wp-content/uploads/2024/05/Screenshot-from-2024-05-20-16-49-01.png)
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer