The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-18-2007
the_learner the_learner is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 75
how do I calculate percentage ?

int percent (int a, int b)
{
if (b/a*100 > 25)
return TRUE;
else
return FALSE;
}

I want to calculate what percentage of a is b.

say if b = 48, a = 100
so b is 48% of a

but wouldnt b/a give me 0 ??? what can be done ??