+ 1
I have a dump question! Why 3/2=1 though z is float not integer??
2 Respuestas
+ 3
x and y also need to be floats because if you divide an int by an int the answer will be an int
+ 3
write like below.
int x = 3;
int y = 2;
float z = (float)x / y;
Console.WriteLine(quot;z = {z}\nx / y = {(float)x/y}");