Answers for "how to add int to float in rust without changing it's type"

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

Code answers related to "how to add int to float in rust without changing it's type"

Browse Popular Code Answers by Language