How to print a decimal number to three decimal places in Rust

1 Answer

0 votes
fn main() {
    let number: f64 = 283742.4397;
    
    println!("{:.3}", number); 
}



/*
run:
  
283742.440
  
*/

 



answered Nov 13, 2024 by avibootz
...