Skip to content

Instantly share code, notes, and snippets.

@chikoski
Last active December 21, 2020 23:07
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 chikoski/25c84918885d514bc073a7a494c95fdc to your computer and use it in GitHub Desktop.
Save chikoski/25c84918885d514bc073a7a494c95fdc to your computer and use it in GitHub Desktop.
fn fizzbuzz(number: u32) -> String{
if number % 15 == 0 {
"fizzbuzz".to_owned()
}else if number % 5 == 0 {
"buzz".to_owned()
}else if number % 3 == 0 {
"fizz".to_owned()
}else{
format!("{}", number)
}
}
fn main(){
for number in 0..50{
println!("{}", fizzbuzz(number));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment