MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / isArmstrongNumber

Method isArmstrongNumber

Java/Armstrong-Number.java:37–50  ·  view source on GitHub ↗
(int N, int k)

Source from the content-addressed store, hash-verified

35 }
36
37 public static boolean isArmstrongNumber(int N, int k) {
38 long powerSum = 0;
39 int n = N;
40
41 while (n != 0) {
42 int rem = n % 10;
43
44 powerSum += (int) Math.pow(rem, k);
45
46 n /= 10;
47 }
48 System.out.println(powerSum);
49 return (powerSum==N);
50 }
51
52}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected