| 1 |
/* FizzBuzz in Tiny |
| 2 |
Count from 1 to (limit), printing "Fizz" for multiples of 3, "Buzz" for multiples of 5, |
| 3 |
and "FizzBuzz" for multiples of 15. |
| 4 |
*/ |
| 5 |
|
| 6 |
int is_divisible(int a, int b) { |
| 7 |
float quo := a / b; |
| 8 |
int iquo := quo; |
| 9 |
return quo = iquo; |
| 10 |
} |
| 11 |
|
| 12 |
int main() { |
| 13 |
limit := 100; |
| 14 |
|
| 15 |
i := 0; |
| 16 |
repeat |
| 17 |
i := i + 1; |
| 18 |
show_num := 1; |
| 19 |
|
| 20 |
if is_divisible(i, 3) then write "Fizz"; show_num := 0; end |
| 21 |
if is_divisible(i, 5) then write "Buzz"; show_num := 0; end |
| 22 |
if show_num then write i; end |
| 23 |
|
| 24 |
write endl; |
| 25 |
|
| 26 |
until i = limit |
| 27 |
|
| 28 |
return 0; |
| 29 |
} |