Posted to tcl by aspect at Wed Jul 31 04:10:54 GMT 2019view raw

  1. #include <stdio.h>
  2. int main (int argc, char *argv[]) {
  3. char f[] = "Fizz";
  4. char b[] = "Buzz";
  5. char fb[] = "Fizz-Buzz";
  6. int i;
  7. for (i = 1; i < 101; i++) {
  8. int c = (i%5) ? 0 : 5;
  9. c += (i%3) ? 0 : 3;
  10. switch (c) {
  11. case 3: printf("%s ", f);
  12. break;
  13. case 5: printf("%s ", b);
  14. break;
  15. case 8: printf("%s ", fb);
  16. break;
  17. default: printf("%d ", i);
  18. }
  19. }
  20. return 0;
  21. }
  22.