Created
April 10, 2013 23:40
-
-
Save chikoski/5359400 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(){ | |
let mut from = 1; | |
let to = 100; | |
while from <= to{ | |
let mut msg = ""; | |
if(from % 15 == 0){ | |
msg = "FizzBuzz"; | |
}else if(from % 3 == 0){ | |
msg = "Fizz"; | |
}else if(from % 5 == 0){ | |
msg = "Buzz"; | |
} | |
io::println(fmt!("%03? %s", from, msg)); | |
from = from + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment