Armstrong Number

An Armstrong number is an n-digit number that is equal to the sum of the nth powers of its digits.

Example : 14 + 64 + 34 + 44 = 1634.                 374

  1. // To check armstrong number
  2. java.io.*java.lang.Math.*"Enter a new number :"//gets number of digits
  3. // going to process only > 0
  4. {
  5. r = num%10; // returns first place number
  6. //takes power of p digits to the number
  7. num = num/10; //removes the first place number
  8. "It is Armstrong Number : ""It is Not Armstrong Number :" +temp);
  9. }
  10. }