Skip to content

Instantly share code, notes, and snippets.

@nomuken
Last active August 29, 2015 14:05
Show Gist options
  • Save nomuken/3c80cc8fa78752db15d3 to your computer and use it in GitHub Desktop.
Save nomuken/3c80cc8fa78752db15d3 to your computer and use it in GitHub Desktop.
fizzbuzz
main(i){
for(;++i%30;i%3?i%5?printf("%d\n",i):printf("buzz\n"):i%5?printf("fizz\n"):printf("fizzbuzz\n"));
}
@elzup
Copy link

elzup commented Aug 20, 2014

条件式もprintf文の中に入れちゃえばもう少し省略できるかもしれませんね

    printf("%s\n", i % 2 ? "odd" : "even");

みたいなかんじで

@nomuken
Copy link
Author

nomuken commented Aug 20, 2014

なるほど,流石です

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment