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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -