Skip to content

Instantly share code, notes, and snippets.

@Benhgift
Created May 18, 2012 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benhgift/2722662 to your computer and use it in GitHub Desktop.
Save Benhgift/2722662 to your computer and use it in GitHub Desktop.
gist-cleaner
//returns 3 if divisible by 3, 5 if divisible by 5, and 0 if neither and 10 if both
int fizz_buzz(int num) {
if((num % 3 == 0) && (num % 5 == 0))
return 10;
else if(num % 3 != 0) {
if(num % 5 != 0)
return 0;
else
return 5;
}
return 3;
}
@Benhgift
Copy link
Author

Kay, cleaned it up : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment