Posted to tcl by aspect at Wed Jul 31 04:40:12 GMT 2019view raw

  1. #include <stdio.h>
  2. int main (int argc, char *argv[]) {
  3. char fs[] = "%_$s ";
  4. char s[8];
  5. int i;
  6. for (i = 1; i < 101; i++) {
  7. sprintf(s, "%d", i);
  8. int c = (i%3) ? 0 : 1;
  9. c += (i%5) ? 0 : 2;
  10. fs[1] = "1234"[c];
  11. printf(fs, s, "Fizz", "Buzz", "Fizz-Buzz");
  12. }
  13. return 0;
  14. }
  15.