- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmstrong.java
More file actions
Latest commit
20 lines (17 loc) · 557 Bytes
/
Copy pathArmstrong.java
File metadata and controls
20 lines (17 loc) · 557 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//Program to check weather the given nuber is Armstrong number or not
classArmstrong {
publicstaticvoidmain(String[] args) {
intnum=153,number, temp, total = 0;
number=num;
while (number != 0){
temp = number%10;
total = total + temp*temp*temp;
number /= 10;
}
if (total == num){
System.out.println(num+" is an Armstrong number");
}
else
System.out.println(num+" is not an Armstrong number");
}
}