title: Why doesn't my if-statements return the right numbers?
body: <p>First of all, this is my first week trying out C# or any other programming language for that matter, also my first post here on Stackoverflow!</p>
  <p>Been working on this change calculator for a while now, trying to get it to round the result to either 0 if its &lt;.25, 0.50 if it's between .25 and .75 and 1 if it's &gt;.75. Seems like it's ignoring my if-statements, And on top of that the result I get isn't correct either. Some calculations ends up being negative, which I can't figure out why :/</p>
  <pre><code>        double summa0 = vara - kontant; //item - change
          var extrakt = (int)summa0; //removes decimals out of summa0 = 107
          var avrundsSumma = summa0 - extrakt; //&lt;--- extracts the decimals out of summa0
  
          if (avrundsSumma &lt; 0.25f)
          {
              avrundsSumma = Math.Floor(avrundsSumma);
          }
          else if (avrundsSumma &gt; 0.75f)                          //Runs the decimals through if-statements
          {
              avrundsSumma = Math.Ceiling(avrundsSumma);
          }
          else
          {
              avrundsSumma = 0.5;
          }                                       // = in this case the result should be 1
  
  
          double summa = extrakt + avrundsSumma; // 107 + 1 = 108
          double attBetala = kontant - summa; // 500 - 108 = 392
  </code></pre>
  <p>Since I'm very new to this it's hard to know exactly which part of the code is causing the issue. When I run the code in CMD I get a negative result from &quot;double summa = extrakt + avrundsSumma; // 107 + 1 = 108&quot;
  So instead of 108 I get -108.</p>
  <p>Not sure what you mean by &quot;Hard code the values&quot; either :o</p>