📜  java代码示例中的armstrong数字

📅  最后修改于: 2022-03-11 14:52:24.010000             🧑  作者: Mango

代码示例1
int c=0,a,temp;  
    int n=153;//It is the number to check armstrong  
    temp=n;  
    while(n>0)  
    {  
    a=n%10;  
    n=n/10;  
    c=c+(a*a*a);  
    }  
    if(temp==c)  
    System.out.println("armstrong number");   
    else  
        System.out.println("Not armstrong number");