Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - int a= 12,b = 5; Floating c; Calculate c equals a divided by b, and the result is 2? C language programming
int a= 12,b = 5; Floating c; Calculate c equals a divided by b, and the result is 2? C language programming
int a = 12;

int b = 5;

Floating point c = (floating point) a/(floating point) b;

Calculated in this way, there is a decimal; If the type is unchanged, only the integer part is taken.