Skip to content

Commit e697204

Browse files
authored
Update ArmstrongNumber.java
1 parent 1369f88 commit e697204

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Number Theory/ArmstrongNumber.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public static void main(String[] args) {
1717
int temp = num;
1818

1919
int result;
20+
//we will break the number into individual digits and cube it and then
21+
//sum the cubes of individual digits
2022
for(result = 0; 0 < num; num /= 10) {
2123
int rem = num % 10;
2224
result += rem * rem * rem;
2325
}
24-
26+
// we check if the number is armstrong or not
2527
if (temp == result) {
2628
System.out.println(temp + " is a armstrong number");
2729
} else {

0 commit comments

Comments
 (0)