Skip to content

Instantly share code, notes, and snippets.

@donkaban
Created May 2, 2020 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donkaban/b5b837a610f58b55e9918e14ecc4fd9b to your computer and use it in GitHub Desktop.
Save donkaban/b5b837a610f58b55e9918e14ecc4fd9b to your computer and use it in GitHub Desktop.
#include <iostream>
int main()
{
for(int i=1, c=1, d=1; i<=100; ++i, ++c, ++d)
{
if(3 == c) c = 0;
if(5 == d) d = 0;
if(c && d ) std::cout << i;
if(!c) std::cout << "Fizz";
if(!d) std::cout << "Buzz";
std::cout <<std::endl;
}
return 0;
}
#include <iostream>
int main()
{
for(int i=1, c=1, d=1; i<=100; ++i, ++c, ++d)
{
if(3 == c) c = 0;
if(5 == d) d = 0;
if(c && d ) std::cout << i;
if(!c) std::cout << "Fizz";
if(!d) std::cout << "Buzz";
std::cout <<std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment