You can try something like this:
double value = ((double)fsize / (double)tsize) * 100.0;
if fsize
int
, and tsize
- int
, then division is also int
, and 0 is the correct answer. You need to convert it to in double
order to return the correct value.
source
to share