|
|
|
|
|
by strong_silent_t
3047 days ago
|
|
Everytime this question comes up I am powerless to resist re-implementing it. http://codepad.org/KKut69jV #include <stdio.h>
int main() {
int i;
for (i = 1; i < 101; i++) {
int div3 = 0 == i % 3;
int div5 = 0 == i % 5;
if (div3 || div5) {
printf("%s%s\n",
div3 ? "fizz" : "",
div5 ? "buzz" : "");
} else {
printf("%d\n", i);
}
}
return 0;
}
I will admit, it took me 4 tries to get this to compile. |
|