I\'m trying to divide two integers and multiply by 100 but it keeps giving only 0 or 100. Can someone help me?
int x= (a/b)*100;
if a w
Try this:
int x = a * 100 / b;
The idea is, you are first doing a / b, and because it's an integer operation, it'll round the result to 0. Doing a * 100 first should fix it.
a / b
0
a * 100