Program for Armstrong Numbers In Java
public class Armgston{
public static void main(int num){
int a=num;
int arm=0; int rem;
while(num>0){
rem= num%10;
arm=arm+rem*rem*rem;
num=num/10;
}
if(arm==a){
System.out.println("The number is Armgston");
}
else{
System.out.println("The number is not Armgston");
}}}
إرسال تعليق