Zig SolutionsZig Solutions
🎆
Happy New Year
Week 1, 2026
All SolutionsZig runtime solution with nested iteration | asherx14 | Zig Solutions
const print = @import("std").debug.print;
fn fireworks(size: u8) void {
const column_height = (size - 1) / 2;
for (0..size) |i| {
if (i < column_height) { print_line(size, i); }
else if (i == column_height) {
for (0..size) |_| {
print("-", .{});
}
print("\n", .{});
}
else { print_line(size, i); }
}
}
fn print_line(size: u8, padding: usize) void {
const middle_idx = @as(u16, (size - 3) / 2) + 1;
for (0..size) |i| {
if (i == 0 + padding) { print("\\", .{}); }
else if (i == size - 1 - padding) { print("/", .{}); }
else if (i == middle_idx) { print("|", .{}); }
else { print(" ", .{}); }
}
print("\n", .{});
}
pub fn main() void {
fireworks(99);
}