title: conversion of decimal to hexadecimal in Embedded C
body: <p>I want to convert decimal number to hexadecimal in Embedded C.</p>
  
  <p>Actually in my project input to controller is decimal which will be subtracted from hexadecimal value, so I need a conversion.</p>
  
  <p>I tried to write it but after converting a number (<code>75</code> for example) to its hexadecimal equivalent it will be (<code>411</code>). The trouble is that I did not know how to convert a number like <code>11</code> to <code>b</code> in hexadecimal as you know that there is no <code>11</code> in hexadecimal, it is <code>b</code>; so please help.</p>
  
  <p>I want to save the converted value in a flag (for subtracting), not for printing. I can print a hex value by simple put a condition like: </p>
  
  <pre><code>(if (a &gt; 10) printf("b"))
  </code></pre>
  
  <p>but this is not a solution for Embedded.</p>
  
  <p>So please give me a complete solution.</p>