Created
October 17, 2017 19:24
-
-
Save JohnPhamous/65152801b85b6ac867bb7e7a9b91c44e to your computer and use it in GitHub Desktop.
This file contains 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> | |
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