A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava in Zig page! Here, you'll find the source code for this program as well as a description of how the program works.
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
const spaces = " " ** 10;
const stars = "*" ** 21;
var i: i32 = -10;
while (i <= 10): (i += 1) {
const numSpaces: usize = @intCast(@abs(i));
const numStars: usize = 21 - numSpaces * 2;
try stdout.print("{s}{s}\n", .{spaces[0..numSpaces], stars[0..numStars]});
}
}
Baklava in Zig was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.