perc=(sum/total)*100;
i've been trying to put this in the code in cprogramming,but output for this part is showing 0,,,Why is this happening and what else should I do in these types of scenerios?
perc=(sum/total)*100;
i've been trying to put this in the code in cprogramming,but output for this part is showing 0,,,Why is this happening and what else should I do in these types of scenerios?
Since you didnt post source and this question will be closed soon, the cause is from integer division most likely. Try this instead.
float perc = ((float)sum / (float)total) * 100.0;
Heres a post on integer division if you are interested in learning why this behavior is doing what it did: What is the behavior of integer division?