Armstrong number: The number is said to be an Armstrong number if the sum of the cubes of each digits is equal to the number itself.
Ex: 407 = Sum of its cubes =4**3+0**3+7**3=407.It is an Armstrong number.
704 = Sum of its cubes = 7**3+0**3+4**3 = 407.So it is not an Armstrong number.
#To check Armstrong number for 3 digits.
|Enter a number: 153
153 is an Armstrong number
Enter a number: 351
351 is not an Armstrong number
Initially, we take input from the user and to check that input number is an Armstrong number or not we initialize ‘sum’ value to zero and obtain every digit number by using ‘%(modulo)’ operator. When that number is dividing by 10 then the remainder of a number is the last digit of that number. The cubes of those digits are evaluated by using ‘exponent(*)’ operator. Using ‘if-else’ condition we compare the sum with the actual number. If they are equal, then we confirm that it is an Armstrong number.
#To check Armstrong number of n digits.
|Enter a number: 1634
1634 is an Armstrong number
Enter a number: 54748
54748 is an Armstrong number
Enter a number: 12345654
12345654 is not an Armstrong number
#To print the Armstrong number between a specified range.
|Enter lower limit: 1234
Enter upper limit: 12345
Enter lower limit: 100
Enter upper limit: 200