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
Integer division has no fractions, so 500 / 1000 = 0.5 (that is no integer!) which gets truncated to integer 0. You probably want
int x = a * 100 / b;