Skip to content

Instantly share code, notes, and snippets.

@KeenS
Last active October 4, 2017 01:32
Show Gist options
  • Select an option

  • Save KeenS/e582f4657cce68c09801bd9d0496b03d to your computer and use it in GitHub Desktop.

Select an option

Save KeenS/e582f4657cce68c09801bd9d0496b03d to your computer and use it in GitHub Desktop.
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