Skip to content

Instantly share code, notes, and snippets.

@ethagnawl
Created January 24, 2017 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethagnawl/2c2363cd40d84e5bd3d4f8eabea79f07 to your computer and use it in GitHub Desktop.
Save ethagnawl/2c2363cd40d84e5bd3d4f8eabea79f07 to your computer and use it in GitHub Desktop.
C FizzBuzz Implementation
#include <stdio.h>
int main(void) {
int i;
for (i = 1; i <= 100; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
printf("fizzbuzz\n");
} else if (i % 3 == 0) {
printf("fizz\n");
} else if (i % 5 == 0) {
printf("buzz\n");
} else {
printf("%d\n", i);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment