We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1369f88 commit e697204Copy full SHA for e697204
1 file changed
Number Theory/ArmstrongNumber.java
@@ -17,11 +17,13 @@ public static void main(String[] args) {
17
int temp = num;
18
19
int result;
20
+ //we will break the number into individual digits and cube it and then
21
+ //sum the cubes of individual digits
22
for(result = 0; 0 < num; num /= 10) {
23
int rem = num % 10;
24
result += rem * rem * rem;
25
}
-
26
+ // we check if the number is armstrong or not
27
if (temp == result) {
28
System.out.println(temp + " is a armstrong number");
29
} else {
0 commit comments