How to find the Division of Two Numbers in Rust - Step by Step Examples
How to find the Division of Two Numbers in Rust ?
Answer
To divide two numbers in Rust, you can use the '/' operator.
✐ Examples
1 Division of Two Numbers
In this example,
- We declare variables
numerator
anddenominator
and assign values to them. - We perform the division operation using the
/
operator and print the result.
Rust Program
fn main() {
let numerator = 20;
let denominator = 5;
let quotient = numerator as f64 / denominator as f64;
println!("Division of {} by {} is: {}", numerator, denominator, quotient);
}
Output
Division of 20 by 5 is: 4
Summary
In this tutorial, we learned How to find the Division of Two Numbers in Rust language with well detailed examples.