- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmstrong.java
More file actions
Latest commit
28 lines (24 loc) · 610 Bytes
/
Copy pathArmstrong.java
File metadata and controls
28 lines (24 loc) · 610 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
importjava.util.Scanner;
/**
*
* @author Vidhikara
*/
publicclassArmstrong {
publicstaticvoidmain(String[] args) {
Scannerin = newScanner(System.in);
System.out.println("Enter the no. - ");
longn=in.nextInt();
longsum=0,res,temp=n;
while(n>0){
res=n%10;
sum=sum+(res*res*res);
n=n/10;
}
if(temp==sum){
System.out.println("Armstrong");
}else{
System.out.println("Not Armstrong");
}
in.close();
}
}