70.
Write a function program to input any number and check whether the
given no. is Armstrong or not.
DECLARE FUNCTION ARM (N)
CLS
INPUT "ENTER ANY NUMBER"; N
A=N
AR = ARM (N)
IF A = AR THEN
PRINT A; "IS ARMSTRONG NUMBER"
ELSE
PRINT A; "IS NOT ARMSTRONG NUMBER"
END IF
END
FUNCTION ARM (N)
S = 0
WHILE N < > 0
R = N MOD 10
S = S + R ^ 3
N = N \ 10
WEND
ARM = S
END FUNCTION
No comments:
Post a Comment