A three digit number is called an armstrong number if the sum of the cube of its digits is equal to the number itself. Write an algorithm for the same.
Answers
Answered by
20
Answer:
Step-by-step explanation:
Start
Input : Enter 3 Digit Number
X = abc
Calculate Z = a³ + b³ + c³
Check if ( X = Z)
Print (number X is Armstrong number)
Else
Print Number X is not Armstrong Number
End
Answered by
4
Answer:
Step-by-step explanation:
Start
Input: Enter 3 Digit Number and store it in a variable N
N = xyz
a = N % 10 (It is equal to z)
N = N / 10
b = N % 10 (It is equal to y)
N = N / 10
c = N % 10 (It is equal to x)
Calculate SUM = a³ + b³ + c³ OR ( SUM = x³ + y³ + z³)
Check if ( N == SUM)
Print (number N is Armstrong number)
Else
Print Number N is not Armstrong Number
End
Similar questions