-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfizzbuzz.b
31 lines (30 loc) · 910 Bytes
/
fizzbuzz.b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Language: B
* Web site: https://www.bell-labs.com/usr/dmr/www/kbman.html
* Last tested on: Ubuntu 22.04.5
* Requires: I've verified the program using a B compiler available
* at https://github.com/Leushenko/ybc I have not yet
* set up the `verify` script to use it. Instead, the
* verify script filters the B source code in an ad-hoc
* manner, applicable only to this specific program,
* to generate valid C, which it then compiles and executes.
*/
main() {
auto i;
i = 1;
while (i <= 100) {
if (i % 15 == 0) {
printf("FizzBuzz*n");
}
else if (i % 3 == 0) {
printf("Fizz*n");
}
else if (i % 5 == 0) {
printf("Buzz*n");
}
else {
printf("%d*n", i);
}
i ++;
}
}