Skip to content

Instantly share code, notes, and snippets.

@sicknarlo
Created December 17, 2014 19:32
Show Gist options
  • Save sicknarlo/c955a8282c3bbd2693b7 to your computer and use it in GitHub Desktop.
Save sicknarlo/c955a8282c3bbd2693b7 to your computer and use it in GitHub Desktop.
[CodeEval] Fizz Buzz
#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