Created
January 6, 2018 23:37
-
-
Save brendtumi/fb6a7d9454e47b4cf24710c3a7e697cd to your computer and use it in GitHub Desktop.
FizzBuzz in Rust
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
fn main() { | |
for i in 1..101 { | |
let mut output = "".to_string(); | |
if i % 3 == 0 { | |
output = output + "Fizz"; | |
}; | |
if i % 5 == 0 { | |
output = output + "Buzz"; | |
}; | |
if output == "" { | |
output = i.to_string(); | |
}; | |
println!("{}", output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment