mirror of
https://codeberg.org/andyscott/exercism.git
synced 2024-11-14 07:10:48 -05:00
12 lines
228 B
Zig
12 lines
228 B
Zig
const std = @import("std");
|
|
|
|
pub fn eggCount(number: usize) usize {
|
|
var count: usize = 0;
|
|
var temp: usize = number;
|
|
|
|
while (temp > 0) : (temp /= 2) {
|
|
if (temp % 2 != 0) count += 1;
|
|
}
|
|
|
|
return count;
|
|
}
|