Skip to content

Instantly share code, notes, and snippets.

@donkaban
Created May 2, 2020 22:43
Show Gist options
  • Save donkaban/b5b837a610f58b55e9918e14ecc4fd9b to your computer and use it in GitHub Desktop.
Save donkaban/b5b837a610f58b55e9918e14ecc4fd9b to your computer and use it in GitHub Desktop.

Revisions

  1. Kirill A. Shabordin created this gist May 2, 2020.
    16 changes: 16 additions & 0 deletions FizzBuzz for dummies
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #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;
    }
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #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;
    }