From 429ba7ef5eb56ed56452dd4c530ae1c56da3f02d Mon Sep 17 00:00:00 2001 From: Phani Pavan K Date: Wed, 14 Aug 2024 15:30:24 +0530 Subject: [PATCH] initial commit --- python/toUpload | 0 rust/day1/.gitignore | 1 + rust/day1/Cargo.toml | 6 ++++++ rust/day1/src/main.rs | 14 ++++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 python/toUpload create mode 100644 rust/day1/.gitignore create mode 100644 rust/day1/Cargo.toml create mode 100644 rust/day1/src/main.rs diff --git a/python/toUpload b/python/toUpload new file mode 100644 index 0000000..e69de29 diff --git a/rust/day1/.gitignore b/rust/day1/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/rust/day1/.gitignore @@ -0,0 +1 @@ +/target diff --git a/rust/day1/Cargo.toml b/rust/day1/Cargo.toml new file mode 100644 index 0000000..fb6b7ec --- /dev/null +++ b/rust/day1/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "day1" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/rust/day1/src/main.rs b/rust/day1/src/main.rs new file mode 100644 index 0000000..6e88184 --- /dev/null +++ b/rust/day1/src/main.rs @@ -0,0 +1,14 @@ +fn main() { + println!("{:?}", calEVlas(-5.0, -7.0, 2.0, 4.0)); +} + +fn calEVlas(a: f32, b: f32, c: f32, d: f32) -> Vec { + let trace = a + d; + let determinant = (a * d) - (b * c); + println!("{determinant}"); + let discri = (trace.powi(2)) - (4.0 * determinant); + println!("{discri}"); + let x1 = (-trace + (discri.powf(0.5))) / 2.0; + let x2 = (-trace - (discri.powf(0.5))) / 2.0; + return vec![x1, x2]; +}