Posts

Showing posts from December, 2019

Armstrong Numbers upto 'n' numbers in JAVA

Armstrong Number in JAVA Armstrong Number : A number is said to be Armstrong Number, If it is a equal to the sum of its own digits each raised to the power of the number of digits. Example: Input                    : 153 No. of Digits        : 3 Sum of digits      : 1 3 + 5 3 + 3 3 = 1 + 125 + 27 = 153 Output                 : It is an Armstrong Number Input                   : 15 No. of Digits       : 2 Sum of digits     : 1 2 + 5 2 = 1 + 25 = 26 Output                : It is not an Armstrong Number Input                   : 1634 No. of Digits      : 4 Sum of digits    : 1 4 + 6 4 + 3 4 + 4 4 = 1 + 1296 + 81 + 256 = 1634 Output               : It is an Armstrong Number