Problem Description
Write a program to check whether the given number is perfect number or not
Input:A positive number
Output:Display the appropriate message
Refer sample input and output for formatting specification.CODING ARENA
n = int(input())
sum1 = 0
for i in range(1, n):
if(n % i == 0):
sum1 = sum1 + i
if (sum1 == n):
print("The number is a Perfect number")
else:
print("The number is not a Perfect number")
Test Case 1
Input (stdin)144
Expected OutputThe number is not a Perfect number
Test Case 2
Input (stdin)6
Expected OutputThe number is a Perfect number
No comments:
Post a Comment