Posted to tcl by aspect at Wed Jul 31 04:40:12 GMT 2019view raw
- #include <stdio.h>
- int main (int argc, char *argv[]) {
- char fs[] = "%_$s ";
- char s[8];
- int i;
- for (i = 1; i < 101; i++) {
- sprintf(s, "%d", i);
- int c = (i%3) ? 0 : 1;
- c += (i%5) ? 0 : 2;
- fs[1] = "1234"[c];
- printf(fs, s, "Fizz", "Buzz", "Fizz-Buzz");
- }
- return 0;
- }