title: Could some one find the error in this code?
body: <p>I've written this program, when i run it and input 20.14, this is the output:</p>
  
  <p>Enter the amount: 20.14
  Change Due:</p>
  
  <p>20 dollars
  0 quarters
  1 dimes
  0 nickels
  3 pennies</p>
  
  <p>It should have been 4 pennies. But it shows 3.
  Here's another output:</p>
  
  <p>Enter the amount: 79.58
  Change Due:</p>
  
  <p>79 dollars
  2 quarters
  0 dimes
  1 nickels
  3 pennies</p>
  
  <p>But for some reason, here is calculated it right. </p>
  
  <p>Can anybody help me find the error? 
  Thanks in advance.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>//Description: This program takes in a dollar amount from the user and
  //and calculates and displays how to make the change using the smallest
  //number of bills and coins possible.
  
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      //Declaring the variables.
      //dollarAmount is the amount that will be input by the user, which
      //will be split into dollars, quarters, dimes, nickels, pennies.
  
      float dollarAmount;
      int dollars = 0, quarters = 0, dimes = 0, nickels = 0, pennies = 0;
  
      //Displaying message to user to input value for dollarAmount.
  
      cout &lt;&lt; "Enter the amount: ";
  
      //Taking in the value for dollarAmount.
  
      cin &gt;&gt; dollarAmount;
  
      //Splitting the dollarAmount into dollars, quarters, dimes,
      //nickels and pennies.
  
      pennies = dollarAmount * 100.0;
      dollars = pennies / 100;
      pennies = pennies % 100;
      quarters = pennies / 25;
      pennies = pennies % 25;
      dimes = pennies / 10;
      pennies = pennies % 10;
      nickels = pennies / 5;
      pennies = pennies % 5;
  
  
  
  
      //Displaying a message to the user with desired output
  
      cout &lt;&lt; "Change Due:\n\n";
      cout &lt;&lt; dollars &lt;&lt; " dollars\n";
      cout &lt;&lt; quarters &lt;&lt; " quarters\n";
      cout &lt;&lt; dimes &lt;&lt; " dimes\n";
      cout &lt;&lt; nickels &lt;&lt; " nickels\n";
      cout &lt;&lt; pennies &lt;&lt; " pennies\n";
  
  
      return 0;
  
  }
  </code></pre>