48. Armstrong Number

Acceptance 100% 1 accepted 1 submissions

Easy
LoopsMath
No companies listed
A number is an Armstrong number if the sum of its digits, each raised to the power of the number of digits, equals the number itself.

Example: 153 has 3 digits, and 1³ + 5³ + 3³ = 1 + 125 + 27 = 153. So 153 is an Armstrong number.
Given n, check whether it is an Armstrong number.

Input Format
A single integer n.

Output Format
Print Armstrong or Not Armstrong.

Constraints
• 1 ≤ n ≤ 10^9

Example 1

Input
153
Output
Armstrong

Explanation 1³ + 5³ + 3³ = 153.

Example 2

Input
9474
Output
Armstrong

Explanation 4 digits: 9⁴ + 4⁴ + 7⁴ + 4⁴ = 9474.

Example 3

Input
123
Output
Not Armstrong

Explanation 1³ + 2³ + 3³ = 36, not 123.

Acceptance 100%
Accepted 1
Submissions 1
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
Armstrong
No results yet
Run your code to test it against the sample cases.
Problem List