Last active
August 13, 2017 09:00
-
-
Save omorgan7/2eeb0a2849289cb9203c229ddd5cbcf7 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++) { | |
if (isMultiple(i, 3) && isMultiple(i, 5)) { | |
std::cout<<"FizzBuzz"<<"\n"; | |
} else if (isMultiple(i, 3)) { | |
std::cout<<"Fizz"<<"\n"; | |
} else if (isMultiple(i, 5)) { | |
std::cout<<"Buzz"<<"\n"; | |
} else { | |
std::cout<<i<<"\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment