I need to apply a formula to three variables. Some of the operations (divisions) give me a 0 instead of the proper number. So I get a different result from what I expected from the formula.
I think that the problem is related to the way C manages data types and their remainders. For this reason, I tried to transform int variables into float variables or to round the numbers that I divided. But all of this is still not working and I'm not able to understand what I'm missing.
Could you please have a look at my code and let me know where is the mistake? Thanks
double grade(int lc, int wc, int sc)
{
wc = (float)wc;
lc = (float)lc;
sc = (float)sc;
float L = round((wc/100)/lc);
float S = round((wc/100)/sc);
float index = 0.0588 * L - 0.296 * S - 15.8;
return index;
}