Skip to content

Instantly share code, notes, and snippets.

@jesuslerma
Created January 15, 2016 23:51
Show Gist options
  • Save jesuslerma/fd9015ebed80d784eae0 to your computer and use it in GitHub Desktop.
Save jesuslerma/fd9015ebed80d784eae0 to your computer and use it in GitHub Desktop.
int array[100];
for(int i = 0; i < array.length(); i ++) {
if (isFizz(array[i]) && isBuzz(array[i])) cout << "FizzBuzz" << endl;
else if ( isFizz(array[i])) cout << "Fizz" << endl;
else if (isBuzz(array[i])) cout << "Buzz" << endl;
}
bool isFizz(int elem) {
return ( elem % 3 == 0);
}
bool isBuzz(int elem) {
return ( elem % 7 == 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment