-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT04.java
More file actions
36 lines (30 loc) · 747 Bytes
/
YT04.java
File metadata and controls
36 lines (30 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.io.*;
class YT04
{
public static void main(String[] args)throws IOException
{
int n;
int r=0;
int sum=0;
int d=0;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the number which you want to check? ");
n=Integer.parseInt(br.readLine());
d=n;
while(n!=0)
{
r=n%10;
sum=sum+(r*r*r);
n=n/10;
}
if(d==sum)
{
System.out.println("RESULT: Armstrong Number");
}
else
{
System.out.println("RESULT: Not");
}
}
}