exercism/zig/square-root/square_root.zig

7 lines
146 B
Zig

pub fn squareRoot(radicand: usize) usize {
var guess: usize = 1;
while (guess * guess < radicand) : (guess += 1) {}
return guess;
}