Created
May 10, 2013 20:02
-
-
Save ArtBears/5556991 to your computer and use it in GitHub Desktop.
The c++ version of the FizzBuzz problem.
This file contains 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> | |
using namespace std; | |
int main() { | |
int a(1); | |
for(int i = 1; i < 101; i++) | |
{ | |
a = i; | |
if(a % 3 == 0 && a % 5 == 0) | |
{ | |
cout << "fizzbuzz" << endl; | |
} | |
else if(a % 5 == 0) | |
{ | |
cout << "buzz" << endl; | |
} | |
else if(a % 3 == 0) | |
{ | |
cout << "fizz" << endl; | |
} | |
else | |
{ | |
cout << a << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment