deeps sinha

Greenhorn

Posts: 26

Eshwin Sukhdeve

Ranch Hand

Posts: 90

posted 5 years ago

- 1

Every natural number y (eg 0,1,2,3....) can be described as:

y = a*x + b

In our case we can see that y = 3 and x = 6, so

3 = a*6 + b

When you use the % operator, it will give you the b variable of the above equation. And keeping in mind that we deal only with natural numbers, the result will be:

3 = 0*6 + 3

thus the result equals 3.

I hope this makes things a little more clear for you.

y = a*x + b

In our case we can see that y = 3 and x = 6, so

3 = a*6 + b

When you use the % operator, it will give you the b variable of the above equation. And keeping in mind that we deal only with natural numbers, the result will be:

3 = 0*6 + 3

thus the result equals 3.

I hope this makes things a little more clear for you.

deeps sinha

Greenhorn

Posts: 26

Campbell Ritchie

Marshal

Posts: 56578

172

posted 5 years ago

Surely that applies to every number, even members of ℝ, so Java™ can use the % operator on floating-point numbers, too.Panagiotis Kalogeropoulos wrote:Every natural number y (eg 0,1,2,3....) . . .

Consider Paul's rocket mass heater. |