Armstrong Number

in Hindi - Armstrong Number



not yet

Source Code :

RUNimport java.util.Scanner;

public class Armstrong
{
public static void main(String args[])
{    
int num, num1, num3=0, ans ;

System.out.println("Enter Number");
Scanner enter = new Scanner(System.in);
num = enter.nextInt();

num1=num;

while(num1!=0){
ans = num1 %10;
num3 = num3 + ans * ans * ans ;
num1 = num1 / 10;
}

if(num == num3){
System.out.println(num + " is an armstrong number");
}
else{
System.out.println(num + " is not an armstrong number");
}
}
}