Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language beginners, help me see why this output result is 0?
C language beginners, help me see why this output result is 0?
1, because you just defined a and b as int type, plastic.

2. Therefore, when calculating a, the formula (A = 12+ 12.4) will be calculated as 24, and the computer will automatically save the structure of statement A as an integer.

3. Before assigning the value of b to floating point A (b = (float) a; ), the result should actually be 24.00.

4. But since you haven't changed the type for B, it is still a shaper. Finally, when the lf floating-point output mode is quoted, the computer cannot recognize it, and the result is zero.

I hope I can help you. If you have questions, please leave a message below.