Skip to content

Instantly share code, notes, and snippets.

@usagi
Created October 8, 2011 17:18
Show Gist options
  • Save usagi/1272581 to your computer and use it in GitHub Desktop.
Save usagi/1272581 to your computer and use it in GitHub Desktop.
fizz-buzz.cpp
#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