| 1 | /* Armstrong number is a three digit number whose sum of cube of each digit is equal to the number |
| 2 | * Example 153 = 1^3 + 5^3 + 3^3 = 153 */ |
| 3 | public class Armstrong { |
| 4 | static boolean Arms(int n){ |
| 5 | int org=n; |
| 6 | int ans = 0; |
| 7 | while(n>0){ |
| 8 | int rem=n%10; |
| 9 | |
| 10 | ans+=rem*rem*rem; |
| 11 | n/=10; |
| 12 | } |
| 13 | return org==ans; |
| 14 | |
| 15 | } |
| 16 | public static void main(String[] args) { |
| 17 | |
| 18 | for (int i=100;i<1000;i++){ |
| 19 | if (Arms(i)){ |
| 20 | System.out.print(i+" "); |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | } |
nothing calls this directly
no outgoing calls
no test coverage detected