WAP using FUNCTION procedure to enter a number and print the number is ARMSTRONG number or not.
DECLARE FUNCTION ARM(N)
CLS
INPUT "ENTER A NUMBER";N
M=N
IF M=ARM(N) THEN
PRINT "NUMBER IS ARMSTRONG"
ELSE
PRINT "NUMBER IS NOT ARMSTRONG"
END IF
END
FUNCTION ARM(N)
WHILE N<>0
R=N MOD 10
S=S+R^3
N=N\10
WEND
ARM=S
END FUNCTION
OR ALTERNATIVE:
DECLARE FUNCTION ARM$(N)
CLS
INPUT "ENTER A NUMBER";N
PRINT "THE NUMBER IS "; ARM$(N)
END
FUNCTION ARM$(N)
M=N
WHILE N<>0
R=N MOD 10
S=S+R^3
N=N\10
WEND
IF M=S THEN
ARM$="ARMSTRONG"
ELSE
ARM$="NOT ARMSTRONG"
END IF
END FUNCTION