class ArmstrongDownload this program Here
{
public static void main(String[] args)
{
int n=143,temp,a=0,i=1;
temp=n;
while(i>0)
{
i=n%10;
a=(i*i*i)+a;
n=n/10;
}
if(a==temp)
System.out.println("the given number is armstrong");
else
System.out.println("the given number is not armstrong");
}
}
aDDa For All ===> Free downloads | eBooks | Softwares | SMS | Fun | News | Codes | Techie | Music | Movies
Mar 19, 2010
JAVA Program to to find whether the given number is Armstrong or not
Subscribe to:
Post Comments (Atom)
Output:
ReplyDeletethe given number is not Armstrong.
Armstrong means if the sum of cubes of each digit in a number is equals to the actual number.
for example 153