Last active
August 9, 2022 02:03
-
-
Save andrewrk/6780fa252b693169897686e907c9da2a to your computer and use it in GitHub Desktop.
fizzbuzz in zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn main() void { | |
var i: usize = 1; | |
while (i <= 100) : (i += 1) { | |
if (i % 3 == 0 and i % 5 == 0) { | |
std.debug.warn("FizzBuzz\n"); | |
} else if (i % 3 == 0) { | |
std.debug.warn("Fizz\n"); | |
} else if (i % 5 == 0) { | |
std.debug.warn("Buzz\n"); | |
} else { | |
std.debug.warn("{}\n", i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment