Rust Program to Divide Two Numbers
Program
fn main()
{
let a = 999;
let b = 100;
println!("Quotient of {0} and {1} is {2}", a, b, a / b);
println!("Remainder of {0} and {1} is {2}", a, b, a % b);
println!("Division output as floating point of {0} and {1} is {2}", a, b, a as f32/ b as f32);
}
Output
$ rustc DivideTwoNumbers.rs
$ ./DivideTwoNumbers
Quotient of 999 and 100 is 9
Remainder of 999 and 100 is 99
Division output as floating point of 999 and 100 is 9.99