int x = 5;
double d1 = 11/x;
double d2 = 11/(double)x;
what is the value of d1-d2
Answers
Answered by
10
The value of d1-d2 is "-0.2".
Explanation:
- In the given code three variable is defined, that are "x, d1, and d2", in which x is integer variable that store value 5.
- In the next line, d1 and d2 are used, which are double variable, in which d1 divides 11 by 5 that will give "2".
- In the next line, d2 variable is used, which divides 11 by 5.0 because it converts the integer to double, and gives 2.2.
- If we divide the value from d1 to d2, it will give "-0.2".
Learn more:
- Output: https://brainly.in/question/12723322
Similar questions