Division with float values : float Calculation « Data Type « C Tutorial






#include <stdio.h>

int main(void)
{
  float plank_length = 10.0f;    
  float piece_count = 4.0f;      
  float piece_length = 0.0f;     

  piece_length = plank_length/piece_count;
  printf("A plank %f feet long can be cut into %f pieces %f feet long.",
                                       plank_length, piece_count, piece_length);
  return 0;
}
A plank 10.000000 feet long can be cut into 4.000000 pieces 2.500000 feet long.








2.21.float Calculation
2.21.1.Division with float values
2.21.2.Read float number and do a calculation
2.21.3.Do a calculation on float number