N = 153
Total Digits = 3
= pow(1,3) + pow(5,3) + pow(3,3)
= 1 * 1 * 1 + 5 * 5 * 5 + 3 * 3 * 3
= 1 + 125 + 27
= 153
If result is same as N, it is armstrong number.
Example 2
Input: 123
Output: Not Armstrong number
N = 123
Total Digits = 3
= pow(1,3) + pow(2,3) + pow(3,3)
= 1 + 8 + 27
= 36
It is not same as N. So it is not Armstrong number
Example 3:
Input: 1634
Output: Armstrong Number
N = 1634
Total Digits = 4
= pow(1,4) + pow(6,4) + pow(3,4) + pow(4,4)
= 1 + 1296 + 81 + 256
= 1634
It is same as given number, Hence this is Armstrong number.