go to previous page   go to home page   go to next page hear noise highlighting

Answer:

199/50 = 3 

50 goes into 199 three times and the remainder, 49, is dropped.


Mixed Integer and Float

Integer division is easy enough to see when it is by itself, but here is a more confusing case of the same thing:

1.5 + 7/2

The division is done first because / has higher precedence than +. The result of the division, 3, is an integer. Now the floating point 1.5 is added to integer 3 to get floating point 4.5.

Integer arithmetic might be used in some parts of an expression and not in others, even though the final value of the expression is floating point.

This can be very confusing. The temptation is to see a floating point value in an expression and then mistakenly do floating point with every operation. For example,

( (3/2)*5.7 ) + 9/10

This evaluates to 5.7. Here is what happens, step-by-step:

( (3/2)*5.7 ) + 9/10
(   1  *5.7 ) + 9/10
     5.7      + 9/10
     5.7      + 0
     5.7

QUESTION 7:

What is the result of evaluating the following expression:

1/2 + 1/2

go to previous page   go to home page   go to next page