Created
July 10, 2025 21:55
-
-
Save Doctor-Coomer/cbf3bba32c1b244b8dfb39a3dc54beff to your computer and use it in GitHub Desktop.
Recursive main fizzbuzz
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(int argc, char* argv[]) { | |
| if (argv != NULL) argc = atoi(argv[1]); | |
| if (argc <= 0) return 1; | |
| const char* result = NULL; | |
| if (argc%3 == 0 && argc%5 == 0) { | |
| result = "FizzBuzz"; | |
| } else if (argc%3 == 0) { | |
| result = "Fizz"; | |
| } else if (argc%5 == 0) { | |
| result = "Buzz"; | |
| } | |
| if (result) printf("%d - %s\n", argc, result); | |
| else printf("%d - %d\n", argc, argc); | |
| main(argc-1, NULL); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile