Created
December 19, 2012 23:30
-
-
Save musaid/4341657 to your computer and use it in GitHub Desktop.
FizzBuzz using the languages i know :)
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
#include <stdio.h> | |
int main() | |
{ | |
int i; | |
for (i=1; i<101; i++) | |
((i%5==0 && i%3==0) ? printf("FizzBuzz\n") : ((i%5==0) ? printf("Buzz\n") : ((i%3==0) ? printf("Fizz\n") : printf("%d\n", i)))); | |
return 0; | |
} |
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
#include <iostream> | |
int main() | |
{ | |
for (int i=1; i<101; i++) | |
((i%5==0 && i%3==0) ? std::cout << "FizzBuzz\n" : ((i%5==0) ? std::cout << "Buzz\n" : ((i%3==0) ? std::cout <<"Fizz\n" : std::cout << i << std::endl))); | |
return 0; | |
} |
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
for(i=1; i<101; i++) ((i%5==0 && i%3==0) ? console.log('FizzBuzz') : ((i%5==0) ? console.log('Buzz') : ((i%3==0) ? console.log('Fizz') : console.log(i)))); |
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
<?php | |
for ($i=1; $i<101; $i++) | |
(($i%5==0 && $i%3==0) ? print("FizzBuzz\n") : (($i%5==0) ? print("Buzz\n") : (($i%3==0) ? print("Fizz\n") : print($i."\n")))); |
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
#!/usr/bin/env python | |
i=1; | |
while(i<101):print(((str(i),"Buzz")[i%5==0],("Fizz","FizzBuzz")[i%5==0])[i%3==0]);i+=1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment