C examples for Data Type:float
The example illustrates how division operations work with variables of type 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;/*from w w w . j a v a2 s. c o m*/ printf("A plank %f feet long can be cut into %f pieces %f feet long.\n", total_length, count, piece_length); return 0; }