397. Armstrong Number Checker
0
Medium
Consider the following input:
A positive integer
Create a function that determines whether the given number is an Armstrong number. An Armstrong number is defined as follows:
A positive integer with n digits is considered an Armstrong number of order n (where order is the number of digits) if the sum of each digit raised to the power of n is equal to the original number.
For example:
1634 is an Armstrong number because 1634 = 1^4 + 6^4 + 3^4 + 4^4
371 is an Armstrong number because 371 = 3^3 + 7^3 + 1^3
Input Format
The input consists of a single line containing an integer.
Output Format
For each test case, print a boolean output.
"true" if the given number is an Armstrong Number, otherwise print "false".
"true" if the given number is an Armstrong Number, otherwise print "false".
Example
Input
371
Output
true
Constraints
0 < N < 1000000000
Loading...
View Submissions
Console