Created
October 8, 2011 17:18
-
-
Save usagi/1272581 to your computer and use it in GitHub Desktop.
fizz-buzz.cpp
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 <iostream> | |
int main(){ | |
for(size_t a = 1; a; ++a){ | |
auto fizz = (a%3==0); | |
auto buzz = (a%5==0); | |
if(fizz) | |
std::cout << "Fizz"; | |
if(buzz) | |
std::cout << "Buzz"; | |
else if(!fizz) | |
std::cout << a; | |
std::cout<<std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment