31 lines
374 B
Plaintext
Raw Normal View History

2024-08-02 23:11:22 +00:00
import log
import sys
main() {
fizzbuzz(15)
}
2024-08-05 16:47:24 +00:00
fizzbuzz(n Int) {
2024-08-02 23:11:22 +00:00
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
}
}
2024-08-05 16:47:24 +00:00
print(address Pointer, length Int) {
2024-08-02 23:11:22 +00:00
sys.write(1, address, length)
}