title: CS50 pset 1 cash issue : code returns abnormal huge amounts
body: <p>I just took the CS50 course and am struggling with the Pset 1. Here is my code :</p>
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  
  int get_cents(void);
  int calculate_quarters(int cents);
  int calculate_dimes(int cents);
  int calculate_nickels(int cents);
  int calculate_pennies(int cents);
  
  int main(void)
  {
      // Ask how many cents the customer is owed
      int cents = get_cents();
  
      // Calculate the number of quarters to give the customer
      int quarters = calculate_quarters(cents);
      cents = cents - quarters * 25;
  
      // Calculate the number of dimes to give the customer
      int dimes = calculate_dimes(cents);
      cents = cents - dimes * 10;
  
      // Calculate the number of nickels to give the customer
      int nickels = calculate_nickels(cents);
      cents = cents - nickels * 5;
  
      // Calculate the number of pennies to give the customer
      int pennies = calculate_pennies(cents);
      cents = cents - pennies * 1;
  
      // Sum coins
      int coins = quarters + dimes + nickels + pennies;
  
      // Print total number of coins to give the customer
      printf(&quot;%i\n&quot;, quarters);
  }
  
  int get_cents(void)
  {
      int owed;
      do
      {
          owed = get_int(&quot;Change owed: &quot;);
      } while (owed&lt;=0);
  
      return owed;
  }
  
  int calculate_quarters(int cents)
  {
      int n;
      while (cents &lt;= 25)
      {
          n++;
          cents = cents - 25;
      }
  
      return n;
  }
  
  int calculate_dimes(int cents)
  {
      int n;
      while (cents &lt;= 10)
      {
          n++;
          cents = cents - 10;
      }
  
      return n;
  }
  
  int calculate_nickels(int cents)
  {
      int n;
      while (cents &lt;= 5)
      {
          n++;
          cents = cents - 5;
      }
  
      return n;
  }
  
  int calculate_pennies(int cents)
  {
      int n;
      while (cents &lt;= 1)
      {
          n++;
          cents = cents - 1;
      }
  
      return n;
  }
  </code></pre>
  <p>The code returns huge amounts like &quot;277258257&quot;.The issue is on the functions but I can't figure out what it is. When I use these same while loops in the main function instead of creating functions, it works perfectly (but then, it doesn't meet the exercise requirement as the CS50 bot also checks if these functions are present in the code).</p>
  <p>P.S : sorry for my English, my main language is French and I sometimes say things weirdly. If anything that I said does not make sense please tell me.</p>