**Java program for Armstrong number. Armstrong numbers** are the sum of their own digits to the power of the number of digits. This **java application** find whether the entered number by user is Armstrong number or not. Here is the program

## Java program for Armstrong number

import java.util.*; class Armstrong { public static void main(String args[]) { int sum=0, b,a, i,n; Scanner sc = new Scanner(System.in); System.out.println("Enter the number to find armstrong number"); b = sc.nextInt(); System.out.println("Your entered number is of how many digits"); n = sc.nextInt(); i = b; while(i!=0) { a=i%10; i=i/10; sum = sum + power(a,n); } if(b==sum) { System.out.println(b +" is armstrong number"); } else { System.out.println(b +" is not an armstrong number"); } } static int power(int c, int d) { int pow=1; int i=1; while(i<=d) { pow=pow*c; i++; } return pow; } }

Here there is no need to create a class to find power………

…………………..because it is found in “Math.pow(int n)”………..just check it once and clarify it.

Right pooja. Thanks for the suggestion, but i thought to provide a pure basic function, so that we can even look for how Math.pow function works.