Created
December 17, 2014 19:32
-
-
Save sicknarlo/c955a8282c3bbd2693b7 to your computer and use it in GitHub Desktop.
[CodeEval] Fizz Buzz
This file contains hidden or 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> | |
#include<fstream> | |
#include<string> | |
using namespace std; | |
int main(){ | |
int line_count = 1; | |
while (cin){ | |
int x, y, n; | |
cin >> x >> y >> n; | |
for (int j = 1; j < n + 1 ; j++){ | |
if (j%x == 0){ | |
if (j%y == 0) | |
cout << "FB "; | |
else | |
cout << "F "; | |
} | |
else if (j%y == 0) | |
cout << "B "; | |
else | |
cout << j << " "; | |
if (j == n) | |
cout << endl; | |
} | |
line_count++; | |
} | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment