Odin SolutionsOdin Solutions
🎆
Happy New Year
Week 1, 2026
All SolutionsOdin: Line by line generation | greenya | Odin Solutions
// This code is in Odin programming language
// (which is not in the list when submitting form)
package main
import "core:fmt"
import "core:strings"
main :: proc () {
for i:=1; i<=99; i+=2 {
fireworks(i)
}
}
fireworks :: proc (size: int) {
fmt.println(#procedure, size)
assert(size>0 && size%2==1, "Expected `size` to be positive odd number")
context.allocator = context.temp_allocator
rep :: strings.repeat
// top part
for s:=size; s>=3; s-=2 {
fmt.print(rep(" ", (size-s)/2))
fmt.print("\\")
fmt.print(rep(" ", (s-3)/2))
fmt.print("|")
fmt.print(rep(" ", (s-3)/2))
fmt.print("/")
fmt.println()
}
// middle part
fmt.println(rep("-", size))
// bottom part
for s:=3; s<=size; s+=2 {
fmt.print(rep(" ", (size-s)/2))
fmt.print("/")
fmt.print(rep(" ", (s-3)/2))
fmt.print("|")
fmt.print(rep(" ", (s-3)/2))
fmt.print("\\")
fmt.println()
}
}