Advertisement
Guest User

Fizz Buzz

a guest
Jan 26th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. //#include <iomanip>
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[]) {
  7. ifstream stream(argv[1]);
  8. string line;
  9. int x, y, n;
  10. while(stream >> x >> y >> n){
  11. if((0<x<21) && (0<y<21) && (20<n<101))
  12. {
  13. for(int i=1; i<=n; i++){
  14. if((i%x || i%y) == 0){
  15. cout <<"FB\t";
  16. continue;
  17. }
  18. else if((i%x) == 0){
  19. cout <<"F\t";
  20. continue;
  21. }else if((i%y) == 0){
  22. cout <<"B\t";
  23. continue;
  24. }else
  25. cout << i << "\t";
  26. }
  27. cout << "\n";
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement