diff --git a/rectangles/Cargo.lock b/rectangles/Cargo.lock new file mode 100644 index 0000000..3eca8f1 --- /dev/null +++ b/rectangles/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "rectangles" +version = "0.1.0" diff --git a/rectangles/Cargo.toml b/rectangles/Cargo.toml new file mode 100644 index 0000000..4a279a4 --- /dev/null +++ b/rectangles/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "rectangles" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/rectangles/src/main.rs b/rectangles/src/main.rs new file mode 100644 index 0000000..506fa3d --- /dev/null +++ b/rectangles/src/main.rs @@ -0,0 +1,13 @@ +fn main() { + let width1 = 30; + let height1 = 50; + + println!( + "The area of the rectangle is {} square pixels.", + area(width1, height1) + ); +} + +fn area(width: u32, height: u32) -> u32 { + width * height +}