float z;
z = (float) (y / x);
Why is the answer 5.0 and not 5.6?
Because you're doing integer devision, and the result of integer division is an integer. So 28 / 5 = 5. Then you're casting the answer to a float, which give you 5.0. If you want 5.6 you will need to make either x or y (or both) a float.
try
(float) y / x or y / (float) x
y / x still integar
int x = 5, y = 28;
float z;
z = (float) (y / x);
Why is the answer 5.0 and not 5.6?