Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(set_stdio)]
- extern crate itoa;
- use std::fs::File;
- use std::io::Write;
- pub fn main() {
- use std::os::unix::io::FromRawFd;
- let mut stdout = unsafe { File::from_raw_fd(1) };
- for i in 1..100_000_000_u32 {
- if i % 15 == 0 {
- stdout.write(b"FizzBuzz\n").unwrap();
- } else if i % 5 == 0 {
- stdout.write(b"Fizz\n").unwrap();
- } else if i % 3 == 0 {
- stdout.write(b"Buzz\n").unwrap();
- } else {
- itoa::write(&mut stdout, i).unwrap();
- }
- }
- }
Add Comment
Please, Sign In to add comment