Skip to content

Instantly share code, notes, and snippets.

@juliandunn

juliandunn/main.rs

Created Dec 2, 2015
Embed
What would you like to do?
Christmas card 2015
use
std::io
; fn
main()
{
let
mut a =
String::new()
; io::stdin()
.read_line(&mut a)
.ok().expect("Failed
to read line")
; let a: i32 = match a
.trim().parse() { Ok(num)
=> num, Err(_) =>
{ panic!("not a number!"); }
}; let w = a * 2 + 5; for x in
0..a { for y in 0..3
{ for z in 0..a-y-x+1 {
print!(" "); } for z in
0..(x*2)+((y*2)+1) {
print!("."); } println!("");
} } for x in 0..w/5+1 { for z in
0..w/3 { print!(" "); } for z in
0..w-(w/3+1)*2 {
print!("#"); }
println!("")
;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment