title: Greedy Algorithm in "C"
body: <p>I'm just start learning <code>C language</code>. I wrote this C code to implement Greedy algorithm
  I don't know what mistake I've made with this code, that code seems fine but its not working as I expected. Can anybody help me to fix this code?</p>
  
  <pre><code>int main(void) {
      float amount = 0;
      int cents = 0;
      int count = 0;
      int amount_left = 0;
  
      amount = .30;
  
      cents = (int)round(amount * 100);
  
      printf("%d", cents);
  
      amount_left = cents;
  
      while (cents - 25 &gt;= 0) {
          count = count + 1;
          amount_left = cents - 25;
      }
      while (amount_left - 10 &gt;= 0) {
          count = count + 1;
          amount_left = amount_left - 10;
      }
      while (amount_left - 5 &gt;= 0) {
          count = count + 1;
          amount_left = amount_left - 5;
      }
      while (amount_left - 1 &gt;= 0) {
          count = count + 1;
          amount_left = amount_left - 1;
      }
      printf("You get %d coins\n", count);
  }
  </code></pre>