double x = 9/2 //x == 4.0?
The output should be 4.5, but is 4.0 What would be the mistake I made?
9/2 <- without decimal you are specify this as a int
9/2 <-
int
9.0 / 2.0 <- this is now double and you should able to get 4.5
9.0 / 2.0 <-
double