Question: Try to run the following java code: double x = 5 / 2 0 ; System.out.println ( x ) ; What answer do you get?
Try to run the following java code:
double x ;
System.out.printlnx;
What answer do you get? The answer is imprecise!
Write a Java program that precisely calculates the decimal value of a fraction, and prints the answer to the screen. The value displayed must be accurate.
Sample Run:
Please enter the numerator:
Please enter the denominator:
The decimal value is:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
