index : temp_converter
Convert temperature degres
about summary refs log tree commit diff
author Justin Zelikoff <justinzelikoff@gmail.com> 2026-07-30 22:03:26 -0400
committer Justin Zelikoff <justinzelikoff@gmail.com> 2026-07-30 22:03:26 -0400
commit d92ac96bf2ae95c556cdaf6e21c9a7ab05881fe8 [patch]
tree 674b6262c52f18c2df3b711cff8477f0efdd7647
parent b7a8915cb7d779f04a83bdbe3f0c1c148a5a46e0
download d92ac96bf2ae95c556cdaf6e21c9a7ab05881fe8.tar.gz

formatting corrections

Diffstat

-rw-r--r-- src/main.rs 22
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 12579a8..d31aff6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,8 +9,8 @@

    println!("Celsius ---> Fahrenheit: Press 2");

    let mut direction = String::new(); 
    let mut start_temp = String::new(); 
    let mut direction = String::new();
    let mut start_temp = String::new();

    io::stdin()
        .read_line(&mut direction)
@@ -27,14 +27,12 @@

    let start_temp: f64 = start_temp.trim().parse().expect("Please type a number!");
    println!("You entered {start_temp}");
    
        if direction == 1 {
            let converted_temp: f64 = (start_temp - 32.0) / 1.8;
            println!("{start_temp}F is {converted_temp}C");
        } else if direction == 2 {
            let converted_temp: f64 = (start_temp * 1.8) + 32.0;
            println!("{start_temp}C is {converted_temp}F");
        }
}   


    if direction == 1 {
        let converted_temp: f64 = (start_temp - 32.0) / 1.8;
        println!("{start_temp}F is {converted_temp}C");
    } else if direction == 2 {
        let converted_temp: f64 = (start_temp * 1.8) + 32.0;
        println!("{start_temp}C is {converted_temp}F");
    }
}