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? Code: #define MINE_DENSITY 0.6 void placeMines(char minefield[MAX_GRID][MAX_GRID], unsigned size) { float sizetotal; sizetotal = size * MINE_DENSITY; printf("%d", sizetotal); }
It shouldnt be an error I guess. It should be warning. Try writing sizetotal = (float)(float)size * MINE_DENSITY; and printf("%f", sizetotal);