34) PERFECT SQUARE OR NOT.(FUNCTION)
DECLARE FUNCTION PERFECT$ (N)
CLS
INPUT “ENTER A NUMBER” ; N
PRINT PERFECT$ (N)
END
FUNCTION PERFECT$ (N)
S = SQR(N)
IF S = INT(S) THEN
PERFECT$=”PERFECT SQUARE”
ELSE
PERFECT$=”NOT PERFECT SQUARE”
END IF
END SUB
DECLARE FUNCTION PERFECT$ (N)
CLS
INPUT “ENTER A NUMBER” ; N
PRINT PERFECT$ (N)
END
FUNCTION PERFECT$ (N)
S = SQR(N)
IF S = INT(S) THEN
PERFECT$=”PERFECT SQUARE”
ELSE
PERFECT$=”NOT PERFECT SQUARE”
END IF
END SUB
0 comments