Answers for "how to add integer and float in rust"

1

how to add integer and float in rust

fn main(){
    let x:f32=20.0;        
    let y:i32=10;
    let sum = x + y as f32;
    println!("{}",sum);
}
Posted by: Guest on August-30-2021
0

how to convert int to float in rust

let y = x as f32;
Posted by: Guest on August-28-2020

Browse Popular Code Answers by Language