Last active
August 13, 2017 09:00
-
-
Save omorgan7/74164997ba36c815f837c8a49281368a 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> | |
bool isMultiple(int n,int divisor) { | |
return n % divisor == 0; | |
} | |
int main() { | |
for (int i = 1; i <= 10000000; i++) { | |
std::string text = std::string(); | |
if (isMultiple(i, 3)) { | |
text += "Fizz"; | |
} | |
if (isMultiple(i, 5)) { | |
text += "Buzz"; | |
} | |
if(text.length() > 0){ | |
std::cout<<text<<"\n"; | |
} | |
else{ | |
std::cout<<i<<"\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment