Armstrong Number Program

Please comment the code in the comments section, it will be added to this post.

One comment on “Armstrong Number Program”


  • Dhanishtha Awasthi

    int cube=0;
    int rem =0;
    int N; // number to be checked for armstrong.
    int N1=N;
    while(N!=0)
    {
    rem = N%10;
    cube = cube+Math.pow(rem,3);
    N=N/10;
    }

    if(cube == N1)
    {
    System.out.println(“Yes Armstrong number”);
    }
    else
    {
    System.out.println(“Not Armstrong number”);
    }