Assume x has type double and i and 1 have type int Modify th


Assume x has type double and i and 1 have type int. Modify the following statement so that x is assigned the value of i divided by j, including its fractional part. For example, if i is 3 and j is 2, then x would be assigned 1.5. x = i/j;

Solution

x=(double)i/j;

Reason:As you have not mentioned i have given the answer in java ,In java you can do it using casting ,as i have done above.

Please do ask in case of any doubt.

 Assume x has type double and i and 1 have type int. Modify the following statement so that x is assigned the value of i divided by j, including its fractional

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site