Question : how to add integer and float in rust
Answered by : bijay-poudel
fn main(){ let x:f32=20.0; let y:i32=10; let sum = x + y as f32; println!("{}",sum);
}
Source : | Last Update : Mon, 06 Sep 21
Question : rust float to int
Answered by : florin-relea
let new_calories: u16 = (food.calories.clone() as f64 * quantity) as u16;
Source : | Last Update : Wed, 02 Nov 22