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