Posted to tcl by aspect at Wed Jul 31 04:10:54 GMT 2019view raw
- #include <stdio.h>
- int main (int argc, char *argv[]) {
- char f[] = "Fizz";
- char b[] = "Buzz";
- char fb[] = "Fizz-Buzz";
- int i;
- for (i = 1; i < 101; i++) {
- int c = (i%5) ? 0 : 5;
- c += (i%3) ? 0 : 3;
- switch (c) {
- case 3: printf("%s ", f);
- break;
- case 5: printf("%s ", b);
- break;
- case 8: printf("%s ", fb);
- break;
- default: printf("%d ", i);
- }
- }
- return 0;
- }