Python Compiler
num = 496 total = 0 for i in range(1, num): if(num % i == 0): total += i if(total == num): print("%d is a perfect number" % num) else: print("%d is not a perfect number" % num)
OUTPUT
496 is a perfect number
×

Save as Private