Cleanup armstrong
This commit is contained in:
parent
44021cacdf
commit
c3316e6ad9
1 changed files with 1 additions and 2 deletions
|
@ -6,8 +6,7 @@ pub fn is_armstrong_number(num: u32) -> bool {
|
||||||
let divisor = 10u32.pow(i);
|
let divisor = 10u32.pow(i);
|
||||||
let quotient = num / divisor;
|
let quotient = num / divisor;
|
||||||
let digit = quotient % 10;
|
let digit = quotient % 10;
|
||||||
let raised = digit.pow(count);
|
digit.pow(count)
|
||||||
raised
|
|
||||||
}).sum();
|
}).sum();
|
||||||
num == armstrong_sum
|
num == armstrong_sum
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue