Help with math in java
Hi, I have written a simple calc that displays times tables or it generates random problems of different operators (i.e., + - x /).
The problem is the random numbers that are generated do not always result in an integer answer, so u get problems like 10 / 7 = 1. If i use doubles the answer is 1.42857, but this is for a forth class student so i only want problems that will result in an integer answer that is correct not like 10 / 7 = 1.
Apart from this my first console attempt works fine just need to adapt to applet.
Use the mod operator to see if the division will result in a whole number. For example in the above problem 10 / 7, you would do 10 % 7 = 3 (% = modulus, it basically returns the remainder). When the modulus equals 0 the answer will be a whole number.