exercism/zig/square-root/square_root.zig

8 lines
146 B
Zig
Raw Normal View History

2024-09-14 22:45:41 -04:00
pub fn squareRoot(radicand: usize) usize {
var guess: usize = 1;
while (guess * guess < radicand) : (guess += 1) {}
return guess;
}