Please fill in the correct answer in each blank provided below.
int a=3; int b=2; double c=3.5; double y=a/b*c;
Ans i have given y=0.4286.
But its wrong can anyone help me on this.
Hakim Rachidi35,362 Points
You first have to divide 3 by 2 (both int so you truncate the result) which is 1 (without truncation 1.5). Finally multiply 1 (int) by 3.5 (double) which results in a double: 3.5;
y = 3.5;