Created
March 25, 2017 00:41
-
-
Save Souzooka/79ca41cddd6b59a45d0bad978ff1d497 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
| void fizzBuzz(int range) | |
| { | |
| for (int i = 1; i <= range; i++) | |
| { | |
| cout << i << ": "; | |
| if (i % 3 == 0 && i % 5 == 0) | |
| { | |
| cout << "Fizz Buzz" << endl; | |
| } | |
| else if (i % 3 == 0) | |
| { | |
| cout << "Fizz" << endl; | |
| } | |
| else if (i % 5 == 0) | |
| { | |
| cout << "Buzz" << endl; | |
| } | |
| else | |
| { | |
| cout << endl; | |
| } | |
| } | |
| } | |
| int main() | |
| { | |
| int range; | |
| cin >> range; | |
| fizzBuzz(range); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment