FizzBuzz Solution

So I wrote up a solution for the FizzBuzz problem, here it is

#include <iostream>

using namespace std;

int main()
{
for (int i = 1; i <= 100; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
cout << "FizzBuzz" << endl;
continue;
}

if (i % 3 == 0)
{
cout << "Fizz" << endl;
continue;
}

if (i % 5 == 0)
{
cout << "Buzz" << endl;
continue;
}

cout << i << endl;

}

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *