Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language problem, changing INT type to float will lead to wrong results. Why?
C language problem, changing INT type to float will lead to wrong results. Why?
# include & ltstdio.h & gt

int main(void)

{

Floating a; /* Variable A is defined as a single-precision floating point */

a = 50% 23; /* Find the modulus from 50 to 23, the modulus is 4, and 4 is an integer (int), which obviously does not match the type of variable A, resulting in compilation error */

printf("a = %d\n ",a); /*%d is an integer data output character and %f is a floating-point output */

Returns 0;

}

Solution: change %d to% f.