int format double arg calculations

musicmancanora4's Avatar
Go4Expert Member
Hey guys imtrying to calculate a figure but i get an error int format double arg
i want to calculate the sizetotal but also round off the sizetotal. How can i do that?

#define MINE_DENSITY 0.6

void placeMines(char minefield[MAX_GRID][MAX_GRID], unsigned size)

  float sizetotal;
  sizetotal = size * MINE_DENSITY;
  printf("%d", sizetotal);

coderzone's Avatar, Join Date: Jul 2004
Team Leader
It shouldnt be an error I guess. It should be warning.

Try writing
sizetotal = (float)(float)size * MINE_DENSITY;


printf("%f", sizetotal);