Skip to content

Instantly share code, notes, and snippets.

@JohnPhamous
Created October 17, 2017 19:24
Show Gist options
  • Save JohnPhamous/65152801b85b6ac867bb7e7a9b91c44e to your computer and use it in GitHub Desktop.
Save JohnPhamous/65152801b85b6ac867bb7e7a9b91c44e to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
cout << "Enter a number from 1 to 100: ";
int userInput;
cin >> userInput;
bool triggered = false;
if (userInput % 3 == 0) {
cout << "Fizz";
triggered = true;
}
if (userInput % 5 == 0) {
cout << "Buzz";
triggered = true;
}
if (!triggered) {
cout << userInput << endl;
}
else {
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment