title: How to get the exact fractional part from a floating point number as an integer?
body: <p>I was trying to extract the exact fractional part from a floating point number. I tried with this:</p>
  <pre><code>float f=254.73;
  
  int integer = (int)f;
  float fractional = f-integer;
  
  printf (&quot;The fractional part is: %f&quot;, fractional);
  </code></pre>
  <p>But the output is: <code>0.729996</code>. For this reason when I was doing this:</p>
  <pre><code>float f=254.73;
  
  int integer = (int)f;
  float fractional = f-integer;
  int fractional_part_in_integer = ((int)(f*100)%100);
  
  printf (&quot;The value is: %d&quot;, fractional_part_in_integer);
  </code></pre>
  <p>It gives me <code>72</code> as output. But, I want to extract exactly <code>73</code> from the given number <code>254.73</code>. I already know how to use <code>%.2f</code> during <code>printf()</code> function to print upto two decimal numbers. But in my code I don't want to print the number right now. I have some calculations with that fractional part as integer form i.e. <code>73</code>.</p>
  <p>So, my problem is how could I extract the fractional part from <code>254.73</code> so that I can get exact <code>73</code> as integer to do more calculations?</p>