Created
November 16, 2014 00:11
-
-
Save Fahrni/14650fd5a65a21798570 to your computer and use it in GitHub Desktop.
FizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void FizzBuzz() | |
{ | |
static int kBufferMax = 256; | |
char outputBuffer[kBufferMax]; | |
for (int x = 1; x <= 100; x++) | |
{ | |
memset(&outputBuffer, 0, kBufferMax); | |
if (0 == (x % 3)) | |
{ | |
strcpy(outputBuffer, "Fizz"); | |
} | |
if (0 == (x % 5)) | |
{ | |
strcat(outputBuffer, "Buzz"); | |
} | |
if (outputBuffer[0]) | |
{ | |
printf("%s - value %d\n", outputBuffer, x); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment