Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to add, subtract, multiply and divide with integers and floating-point numbers in C language?
How to add, subtract, multiply and divide with integers and floating-point numbers in C language?
For the three operations of addition, subtraction, multiplication and division, integers can be used directly.

For division, when two integers are divided in C language, the result is still an integer (only take the quotient part and ignore the remainder). If you want to get the exact value of division (such as 10/4=2.5), you can use floating-point numbers to participate in the calculation. The method is to multiply the dividend by 1.0 and divide it by the divisor, and the result is a floating-point number.