title: Calculating percentages in C
body: <p>I am trying to find out how percentages are calculated within C, and specifically I am trying to find out how much taxes you get from user input, if the tax would be 21%.</p>
  <p>But after trying the code in the terminal with input : 130,
  which means I want 21% of 130$, it gives me a negative value of -858993459</p>
  <p>How do Ifix this or where did I go wrong?</p>
  <p>All of my google searches come up empty too, but probably because I am not using the correct phrasing so all info is welcome.</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  double get_tax_amount(double price_including_taxes)
  {
    return price_including_taxes *0.21;
  }
  
  int main()
  {
    printf(&quot;What was your price? &quot;);
    double price;
    scanf(&quot;%d&quot;, &amp;price);
    printf(&quot;The tax price is: %d&quot;, get_tax_amount (price));      
  }
  </code></pre>