wap to check number is armstrong or not

import java.util.Scanner;
class Armstrong 
{
 public static void main(String[] args)
{
int arm=0,a,b,c,d,no; 
Scanner s=new Scanner(System.in);
System.out.println("Enter any num :");
no=s.nextInt();
d=no;
while(no>0)
{
a=no%10;
no=no/10;
arm=arm+a*a*a;
}
if(arm==d)
{
System.out.println("Armstrong :");
}
else
{
System.out.println("not Armstrong");
}
}
}

Comments

Popular posts from this blog

A story of friendship A tiger and a rat......become a revengable....

best pen drive

wap to perform subtraction