31 lines
358 B
Plaintext
Raw Normal View History

2024-08-02 23:11:22 +00:00
import log
import sys
main() {
fizzbuzz(15)
}
fizzbuzz(n) {
x := 1
loop {
2024-08-03 20:24:40 +00:00
switch {
2024-08-03 22:00:26 +00:00
x % 15 == 0 { print("FizzBuzz", 8) }
x % 5 == 0 { print("Buzz", 4) }
x % 3 == 0 { print("Fizz", 4) }
_ { log.number(x) }
2024-08-02 23:11:22 +00:00
}
x += 1
if x > n {
return
}
2024-08-03 20:24:40 +00:00
print(" ", 1)
2024-08-02 23:11:22 +00:00
}
}
print(address, length) {
sys.write(1, address, length)
}