From 4a0d617ade43829d1a00e39d8b2a9badd425b042 Mon Sep 17 00:00:00 2001 From: Pelz Date: Mon, 30 Sep 2024 10:15:08 +0100 Subject: [PATCH] feat: added solutions --- Solutions/solutions.md | 24 ++++++++++++++++++++++++ src/lib.cairo | 6 ++---- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 Solutions/solutions.md diff --git a/Solutions/solutions.md b/Solutions/solutions.md new file mode 100644 index 0000000..9226dfc --- /dev/null +++ b/Solutions/solutions.md @@ -0,0 +1,24 @@ +fn main() { +let \_difference: u8 = sub_u8(3, 1); +println!("result_diff: {}", \_difference); + + let _product_: u8 = mul_u8(2, 5); + println!("result_product: {}", _product_); + + + let _divident_: u8 = div_u8(10, 5); + println!("result_divident: {}", _divident_); + +} + +fn sub_u8(x: u8, y: u8) -> u8 { +x - y +} + +fn mul_u8(x: u8, y: u8) -> u8 { +x \* y +} + +fn div_u8(x: u8, y: u8) -> u8 { +x / y +} diff --git a/src/lib.cairo b/src/lib.cairo index 587aad4..a3d5d3e 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -1,4 +1,4 @@ -fn main() { + fn main() { let sum_1: u8 = intro_to_uint(); let sum_2: u8 = sum_u8(2, 2); @@ -19,6 +19,4 @@ fn main() { fn sum_u8(x: u8, y: u8) -> u8 { x + y - } - - \ No newline at end of file + } \ No newline at end of file