0

Why is the output 8? And not 10.6666667

double y = 4;   y = y * (8 / 3);

15th Nov 2019, 8:15 AM
Catie Hyman
Catie Hyman - avatar
1 Answer
+ 5
because you have to cast one of the numbers in the division to a double. double y = 4;    y = y * ((double)8 / 3); without casting it to double, (8/3) = 2
15th Nov 2019, 8:43 AM
Bahha┣
Bahha┣ - avatar