
write a program in java to input 10 numbers in an array and print out the Armstrong numbers from the set.

import java.util.*;
class ArmstrongNumbers
{
public static boolean find(int num){
boolean isArmstrong=false;
int n = num;
int check=0,remainder;
while(num > 0){
remainder = num % 10;
check = check + (int)Math.pow(remainder,3);
num = num / 10;
}
if(check == n)
isArmstrong=true;
else
isArmstrong=false;
return isArmstrong;
}
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("Enter Numbers: ");
int array[]=new int[10];
for(int i=0;i<array.length;i++){
array[i]=input.nextInt();
}
System.out.println("Armstrong Numbers are: ");
for(int i=0;i<array.length;i++){
if(find(array[i])){
System.out.println(array[i]);
}
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.