Skip to content

Instantly share code, notes, and snippets.

@silphire
Created July 24, 2017 06:44
Show Gist options
  • Save silphire/eaba149aab44b82ce644d480c9d8fdd1 to your computer and use it in GitHub Desktop.
Save silphire/eaba149aab44b82ce644d480c9d8fdd1 to your computer and use it in GitHub Desktop.
fn fizzbuzz() {
for x in 1..100 {
if x % 3 == 0 {
print!("Fizz ");
} else if x % 5 == 0 {
print!("Buzz ");
} else if x % 3 == 0 && x % 5 == 0 {
print!("FizzBuzz ");
} else {
print!("{} ", x);
}
}
println!("");
}
fn main() {
fizzbuzz();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment