Division operator "/". Binary operators with left associativity. When all the quantities involved in the operation are integers, the result is integers and the decimals are discarded. If one of the operands is a real number, the result is a double-precision real number.
For example:
5/2=2, 1/2=0
5/2.0=2.5
Extended data
The remainder operator "%",a binary operator, is left associative. The quantities involved in the operation are all integers. The result of the remainder operation is equal to the remainder after dividing two numbers.
For example:
5%2= 1, 1%2= 1
The results of 5% 2.0 and 5.0% 2 are grammatical errors.
Turn: When the current number is less than the last number.
In fact, the remainder operation can be regarded as
a%b=a-(int)(a/b)*b
1%2= 1
2%5=2
a%b
If a