Armstrong Number

Armstrong Number is a number whose sum of the power of digits is equal to the original number where power is number of digits in the number.

Example 1: 153. 13+53+33 = 1+125+27 = 153.

Example 2: 1634. 14+64+34+44 = 1+1296+81+256 = 1634.

Java
import java.util.*;
public class ArmstrongNumber
{
    public static void main(String args[])
    {
        int n=0,r=0,s=0,temp=0,count=0;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter a number: ");
        n=sc.nextInt();
        temp=n;
        while(temp>0)
        {
            count++;
            temp=temp/10;
        }
        temp=n;
        while(temp>0)
        {
            r=temp%10;
            s=s+(int)Math.pow(r,count);
            temp=temp/10;
        }
        if(s==n)
        {
            System.out.println(n+" is an Armstrong Number");
        }
        else
        {
            System.out.println(n+" is not an Armstrong Number");
        }
    }
}
Java