Createa a project for calculating rectangles

This commit is contained in:
Manuel Thalmann 2024-11-12 08:46:32 +01:00
parent bca900b692
commit 41fde7bef9
3 changed files with 26 additions and 0 deletions

7
rectangles/Cargo.lock generated Normal file
View file

@ -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"

6
rectangles/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "rectangles"
version = "0.1.0"
edition = "2021"
[dependencies]

13
rectangles/src/main.rs Normal file
View 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
}