- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmstrong.java
More file actions
Latest commit
23 lines (23 loc) · 557 Bytes
/
Copy pathArmstrong.java
File metadata and controls
23 lines (23 loc) · 557 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
importjava.util.*;
publicclassArmstrong
{
publicstaticvoidmain(Stringargs[])
{
Scannersc=newScanner(System.in);
System.out.println("Enter a 3 Digit Number");
intn=sc.nextInt();
intm=n;
intsum=0;
intr;
while(n>0)
{
r=n%10;
n=n/10;
sum = sum+r*r*r;
}
if(sum==m)
System.out.println("Its an Armstrong Number of 3 Digit Number");
else
System.out.println("Its not an Armstrong Number ");
}
}