diff --git a/fahrenheit_to_celsius/Cargo.toml b/fahrenheit_to_celsius/Cargo.toml new file mode 100644 index 0000000..5ffc6fc --- /dev/null +++ b/fahrenheit_to_celsius/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "fahrenheit_to_celsius" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/fahrenheit_to_celsius/src/main.rs b/fahrenheit_to_celsius/src/main.rs new file mode 100644 index 0000000..e9875a6 --- /dev/null +++ b/fahrenheit_to_celsius/src/main.rs @@ -0,0 +1,10 @@ +use std::env; +fn main() { + let args: Vec = env::args().collect(); + let farenheight_input:String = args[1].clone(); + let farenheight:f32 = farenheight_input + .parse() + .expect("No input entered"); + let celsius = (farenheight - 32.0) * (5.0 / 9.0); + println!("F = {}, C = {}",farenheight,celsius); +}