Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string out(int i){
- if (i == 0){
- return to_string(i);
- }
- string output = "";
- if ((i % 3) == 0){
- output += "fizz";
- }
- if ((i % 5) == 0){
- output += "buzz";
- }
- if (output == ""){
- return to_string(i);
- }
- else{
- return output;
- }
- }
- int main()
- {
- for(int i= -30; i<100; i++){
- cout << out(i) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement