Add initial rectangles program
This commit is contained in:
parent
389e439a47
commit
53705f42a4
2 changed files with 22 additions and 0 deletions
9
rectangles/Cargo.toml
Normal file
9
rectangles/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "rectangles"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["laurens <miers132@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
13
rectangles/src/main.rs
Normal file
13
rectangles/src/main.rs
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue