Guest User

Untitled

a guest
Oct 18th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. cout << "Enter a number from 1 to 100: ";
  6. int userInput;
  7. cin >> userInput;
  8.  
  9. bool triggered = false;
  10.  
  11. if (userInput % 3 == 0) {
  12. cout << "Fizz";
  13. triggered = true;
  14. }
  15.  
  16. if (userInput % 5 == 0) {
  17. cout << "Buzz";
  18. triggered = true;
  19. }
  20.  
  21. if (!triggered) {
  22. cout << userInput << endl;
  23. }
  24. else {
  25. cout << endl;
  26. }
  27.  
  28. return 0;
  29. }
Add Comment
Please, Sign In to add comment