Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
double (float) type variable
#2
double d=9/2

at first calculates 9/2. Both are integers, therefore result is integer (4). Then it is assigned to d.
to calculate as doubles, use 9/2.0 or 9.0/2 or 9.0/2.0 or 1.0*9/2 etc.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)