Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, integer is divided by integer to get floating-point type, which is assigned to integer variable. Should I vote?
In C language, integer is divided by integer to get floating-point type, which is assigned to integer variable. Should I vote?
Integer is divisible by integer, so floating-point data cannot be obtained. For example, if Int A = 4 and B = 5, then a/b=0. If you want to get a/b=0.8, you must force one of them to be a floating-point type, such as (float)a/b=0.8 or a/(float)b=0.8. Assigning an integer directly to a floating-point variable is not a big mistake.