Math %


#1

Hi everyone

I am new in coding, so I have very hard time to understand all the instruction correctly and my English is very poor but I will not give up so easy.

I am a bit confused and I ask for help to understand the instructions of exercise 9 Math %.

<<The modulo operator - represented in Java by the % symbol - returns the remainder of dividing two numbers.

For example, 15 % 6 will return the value of 3, because that is the remainder left over after dividing 15 by 6.>>

this example dont make any senses to me or my logic is out of the window.

15 divide by 6 will be 2.5, do i am missing something...!

I will be very grateful for any advice and help.

Best regards
swjmdream


Replace this line with your code.


#2

Time to go back to grade school arithmetic and review long division with a pencil and paper. 2.5 is what the calculator display will read. That is the full quotient, whole number and decimal fraction combined. We want only the remainder when the whole number is taken away.

0.5 * 6 == 3

The modulo is 3, as written in the lesson text.

What is 1/2 an inch expressed in sixteenths?

0.5 * 16  == 8  so 8 sixteenths

What is 3/8 of an inch expressed in thirty-seconds?

0.375 * 32 == 12  so 12 thirty-seconds

24 modulo 16 is 8. The calculator will show 1.5 as the quotient.

44 modulo 32 is 12. The calculator will show 1.375 as the quotient.


#3

Hi mtf

Thanks a lot for your answer, i appreciate your time.

Cheers
swjmdream


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.