Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What are the symbols of rounding and remainder in C language?
What are the symbols of rounding and remainder in C language?
If the operand is an integer, it is an integer division, otherwise it is a floating-point division, and the sign of the remainder is%.

1, modulo operation (mod) and remainder operation are often confused, because in most programming languages, modulo operation or remainder operation is represented by "%"symbol. Here I would like to remind you to pay great attention to the specific meaning of the "%"operator in the current environment, because in the case of negative numbers, the results of the two are different.

2. Modular operation and remainder operation are different in the first step:? When taking the value of c (fix () function), the modulo operation is rounded to 0; ? When calculating the value of c (floor () function), the modular remainder operation rounds to infinity.

3. When the signs of A and B are the same, the value of C obtained by modular operation and remainder operation is the same, so the result is the same. But when the symbols are inconsistent, the result is different. Specifically, the sign of the modular operation result is consistent with B, while the sign of the complementary operation result is consistent with A. ..

4. In C language, the symbol% means remainder operation, and in Python script,% means module.