Compare commits
2 Commits
4c48c1b0af
...
c77249b6c8
Author | SHA1 | Date | |
---|---|---|---|
c77249b6c8 | |||
4100832f8c |
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,3 +21,4 @@ Cargo.lock
|
|||||||
#.idea/
|
#.idea/
|
||||||
**/target
|
**/target
|
||||||
**/debug
|
**/debug
|
||||||
|
main
|
||||||
|
6
fahrenheit_to_celsius/Cargo.toml
Normal file
6
fahrenheit_to_celsius/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "fahrenheit_to_celsius"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
10
fahrenheit_to_celsius/src/main.rs
Normal file
10
fahrenheit_to_celsius/src/main.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use std::env;
|
||||||
|
fn main() {
|
||||||
|
let args: Vec<String> = 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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user