algorithm - Percentage in C Language -


i need algorithm in language c this:

0   ..... 100% 255 ..... 0% 50  ..... x% 

how find out how many x? know how this:

255 .... 100% 50  .... x% 

and solve this:

x = (50*100)/255; 

try this:

float percentage = 100.0 - (input*100/255);  

the idea calculate percentage on range [0..255]. so, divide whatever number 255 , multiply 100. want invert input, 0 100% , 255 0%. that, subtract 100.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -