Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Add Comment
Please, Sign In to add comment