import java.io.*;
class ArmStrong_Number
{
public static void main(String args[])throws IOException
{
System.out.println("");
InputStreamReader reader=new InputStreamReader(System.in);
BufferedReader input=new BufferedReader(reader);
System.out.println("PLEASE INPUT THE NUMBER");
int n=Integer.parseInt(input.readLine());
int backup=n;
String l=Integer.toString(n);
int sum=0;
int d,t;
while(n!=0)
{
d=n%10;
t=d*d*d;
sum=sum+t;
n=n/10;
}
if(sum==backup)
System.out.println("ARMSTRONG NUMBER");
else
System.out.println("NOT AN ARMSTRONG NUMBER");
}
}
1>Download CLASS File
2>Download SOURCE Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment