+1
int (5*2.4) =12 int (5)*(2.4) =10 Why this expression gives different results?
2/2/2017 7:29:54 PM
5 Answers
+2
tried this two on Ubuntu, first is int 12, second 12 in float.
2.4 in int is 2, then 5*2=10.
int(2.4) chops off the ".4"
Because int(5*2.4) converts 12.0 to an integer, int(5)*(2.4) only converts 5 to int. THEN multiply it by 2.4, and gives you 12.0 as a float
sorry guys I mean, the second expression is: int (5)* int (2.4) =10 Why 10 and not 12
Send us a message