Write an algorithm to check whether a
number is an Armstrong number or not ?
Answers
Answered by
1
Algorithm
Input the number.
Initialize sum=0 and temp=number.
Find the total number of digits in the number.
Repeat until (temp != 0)
remainder = temp % 10.
result = resut + pow(remainder,n)
temp = temp/10.
if (result == number)
Answered by
0
Answer:
Step 1: START
Step 2: INPUT N
Step 3: SET SUM=0,D=N
Step 4: REM= N%10
Step 5: SUM= SUM+(REM*REM*REM)
Step 6: N=N/10
Step 7: REPEAT STEPS 4 TO 6, UNTIL N>0
Step 8: IF SUM=D
PRINT “NUMBER IS ARMSTRONG”
ELSE
PRINT “NUMBER IS NOT ARMSTRONG”
Step 9: STOP
Similar questions