title: CS50 PS 1 Greedy
body: <p>Looking for some advice about why this is running so strangely.  Everything over <code>.25</code> works perfectly, but anything lower than <code>.25</code> and I'm getting some really strange results.  What's wrong?</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main(void)
  {
  int v;
  int count;
  int q= 25;
  int d= 10;
  int n= 5;
  int p= 1;
  float m;
  
  do
  { 
      printf("How many coins do you need for this change?:\n");
      m=GetFloat();
  }    
  while (m&lt;0);
  
  
  int balance;
  
  m=m*100;
  balance= round (m);
  
  
  
  while (balance &gt;= q)
  {
      v=balance/q;
      count=v;
      balance=balance-(v*q);
  
  
  }
  
  while (balance &gt;= d)
  {
      v=balance/d;
      count=count+v;
      balance=balance-(v*d);
  
  }
  
  while (balance &gt;= n)
  {
      v=balance/n;
      count=count+v;
      balance=balance-(v*n);
       printf("%i\n", count);
      printf("%i\n", count);
  
  }
  
  while (balance &gt;= p)
  {
      v=balance/p;
      count=count+v;
      balance=balance-(v*p);
  
  }   
  
  printf("Total number of coins needed:%i\n", count);
  }   
  </code></pre>