Computer Science, asked by Aditiraj146, 4 months ago

java menu driven program to check whether the given no. is armstrong or not​

Answers

Answered by Anonymous
1

Answer:

 Answer : class ArmstrongExample{  </p><p>  public static void main(String[] args)  {  </p><p>    int c=0,a,temp;  </p><p>    int n=153;//It is the number to check armstrong  </p><p>    temp=n;  </p><p>    while(n&gt;0)  </p><p>    {  </p><p>    a=n%10;  </p><p>    n=n/10;  </p><p>    c=c+(a*a*a);  </p><p>    }  </p><p>    if(temp==c)  </p><p>    System.out.println("armstrong number");   </p><p>    else  </p><p>        System.out.println("Not armstrong number");   </p><p>   }  </p><p>}

Similar questions