44.
Write a function
program to find whether the given number is perfect number or not.
DECLARE FUNCTION PERFECT
(N)
CLS
INPUT "ENTER ANY
NUMBER"; N
PR = PERFECT (N)
IF PR = N THEN
PRINT "PERFECT NUMBER"
ELSE
PRINT "NOT PERFECT NUMBER"
END IF
END
FUNCTION PERFECT (N)
S = 0
FOR I = 1 TO N - 1
IF N MOD I = 0 THEN S = S
+ I
NEXT I
PERFECT = S
END FUNCTION
No comments:
Post a Comment