DEV Community

hema latha
hema latha

Posted on

Armstrong Number Program

package day1;

public class Amstrong {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    int no = 1634;
    int no1 = no;
    int armstrong = 0;
    while(no>0)
    {
        int rem= no%10;
        armstrong = armstrong + (rem*rem*rem*rem);
        no = no/10;
    }
    System.out.println(armstrong);
    if (armstrong == no1)
        System.out.println("armstrong");
    else 
        System.out.println("Not armstrong");

}
Enter fullscreen mode Exit fullscreen mode

}

out put = 1634
armstrong

Top comments (0)