Day 2: integers and floats
The Rust Programming Language Forum
Day 2: integers and floats
fn main() { let temp_celsius = 25; println!("Celsius: {}",temp_celsius); let conversion_factor = 1.8; println!("Conversion factor: {}",conversion_factor); let temp_fahrenheit = temp_celsius as f64 * conversion_factor + 32.0; println!("Fahrenheit: {}",temp_fahrenheit); let temp_celsius = temp_fahrenheit as i32; println!("Rounded Fahrenheit(integer): {}",temp_celsius); let extra_float = 0.35f32; println!("Extra: {}",extra_float); let total = temp_fahrenheit + extra_float as f64; println!("Final te...
0 comments
No comments yet.