A simple and educational Rust program that performs arithmetic rounding โ rounding any number entered by the user to the nearest whole number using standard mathematical logic.
When you run the program, it:
- Prompts the user to enter a number (for example:
3.6or-2.4). - Calculates the fractional part of the number.
- Decides whether to round up or down based on standard rounding rules.
- Displays the step-by-step reasoning and the final rounded result.
Enter a number: 3.6
You entered: 3.6
Step 1: The fractional part is 0.6
Step 2: Since 0.6 >= 0.5, we round up
Result: 4