Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char** argv)
- {
- int i;
- int mfive, mthree;
- i = mthree = mfive = 1;
- while (i <= 100) {
- /* output */
- if (mfive == 5 && mthree == 3) {
- printf("FizzBuzz\n");
- mfive = mthree = 0;
- } else if (mfive == 5) {
- printf("Buzz\n");
- mfive = 0;
- } else if (mthree == 3) {
- printf("Fizz\n");
- mthree = 0;
- } else {
- printf("%i\n", i);
- }
- /* increment counters */
- i++;
- mthree++;
- mfive++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement