Last active
October 4, 2017 01:32
-
-
Save KeenS/e582f4657cce68c09801bd9d0496b03d to your computer and use it in GitHub Desktop.
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
| use std::io::{self, Write}; | |
| fn main() { | |
| let n = 600000; | |
| let out = io::stdout(); | |
| let mut out = out.lock(); | |
| for i in 1..n { | |
| let mut str = "".to_owned(); | |
| if i % 3 == 0 { | |
| str.push_str("Fizz"); | |
| } | |
| if i % 5 == 0 { | |
| str.push_str("Buzz"); | |
| } | |
| if str.len() > 0 { | |
| writeln!(out, "{}", str).unwrap(); | |
| } else { | |
| writeln!(out, "{}", i).unwrap(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment