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, and then assigned to floating-point type. What should I do?
In C language, integer is divided by integer to get floating-point type, and then assigned to floating-point type. What should I do?
For example:

Internationalorganizations (same as international organizations)

a=3,b = 5;

double;twofold

c = 0;

c = a/b;

//At this time, c = 3/5 = 0;;

c = a/(double)b;

At this time c = 3/5.0 = 0.6;;

Description:

while

Integer divided by integer

It can only be shaped and needs to be cast to floating-point type.

while

When the divisor or dividend has floating point, it is automatically converted to floating point.