该示例说明了如何使用float
类型变量除法运算。
#include <stdio.h>
int main(void)
{
float total_length = 10.0f; // In feet
float count = 4.0f; // Number of equal pieces
float piece_length = 0.0f; // Length of a piece in feet
piece_length = total_length/count;
printf("A plank %f feet long can be cut into %f pieces %f feet long.\n",
total_length, count, piece_length);
return 0;
}