From 4ed821f1ae7028253494946a08e85729e29f3d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Thu, 27 Aug 2015 22:51:38 +0200 Subject: [PATCH] Uploaded FizzBuzz Implementation with Ternary had to use the printf statements inside because char* and int can't be displayed with same %-label thing --- FizzBuzzTernary.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 FizzBuzzTernary.c diff --git a/FizzBuzzTernary.c b/FizzBuzzTernary.c new file mode 100644 index 0000000..d4be239 --- /dev/null +++ b/FizzBuzzTernary.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + for(int i = 0; i < 100; i++) + i % 3 == 0 && i % 5 == 0 ? printf("FizzBuzz\n") : i % 3 == 0 ? printf("Fizz\n") : i % 5 == 0 ? printf("Buzz\n") : printf("%i\n", i); +}