-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram57.java
48 lines (38 loc) · 867 Bytes
/
Program57.java
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
37
38
39
40
41
42
43
44
45
46
47
// Armstrong Number
import java.util.*;
class Armstrong
{
public static void armstrong(int ino)
{
int irem=0;
int itemp=0;
int arm=0;
itemp=ino;
while(ino>0)
{
irem=ino%10;
arm=(irem*irem*irem)+arm;
ino=ino/10;
}
if(itemp==arm)
{
System.out.println("IT IS ARMSTRONG NUMBER");
}
else
{
System.out.println("IT IS NOT AN ARMSTRONG NUMBER");
}
}
}
class Program57
{
public static void main(String args[])
{
int ivalue=0;
Scanner sobj=new Scanner(System.in);
System.out.println("Enter the number");
ivalue=sobj.nextInt();
Armstrong aobj=new Armstrong();
aobj.armstrong(ivalue);
}
}