title: Endless value output when trying to compute user input, C Language
body: <p>I'm a beginner at learning C and am using CodeStepByStep to practice, but I've recently been stuck at the receipt2 exercise:</p>
  <p><strong>The following console program always computes the same output. Modify it to be an interactive program that prompts the user to enter the meal cost as shown and computes the rest of the values based on that meal cost. Here are two example logs of execution:</strong></p>
  <pre><code>What was the meal cost? $50
  Subtotal: $50.00
  Tax: $4.00
  Tip: $7.50
  Total: $61.50
  </code></pre>
  <pre><code>What was the meal cost? $125
  Subtotal: $125.0
  Tax: $10.00
  Tip: $18.75
  Total: $153.75
  </code></pre>
  <p>This is the code I came up with:</p>
  <pre><code>int main() {
      
      double subtotal;
      double tax = subtotal * .08;
      double tip = subtotal * .15;
     double total = subtotal + tax + tip;
      
      printf(&quot;What was the meal cost? $&quot;);
      scanf(&quot;%1f\n&quot;, &amp;subtotal);
      
      printf(&quot;Subtotal: $%.2f\n&quot;, subtotal);
      printf(&quot;Tax: $%.2f\n&quot;, tax);
      printf(&quot;Tip: $%.2f\n&quot;, tip);
      printf(&quot;Total: $%.2f\n&quot;, total);
      return 0;
  }
  </code></pre>
  <p>And this is what I get:</p>
  <pre><code>What was the meal cost? $50
  Subtotal: $1487596185306552356576543796496142744039674099895955705687117069098083127278735...
  Tax: $119007672208353363661503531346055809843579575493495085918530749993454701233205893051...
  Tip: $223139385390662542606067286932452039577591885184656158736966400576173810359277903991...
  Total: $1829742960203432862406782001386817676654305864334200732372522204186617249017377688...
  </code></pre>
  <p>I'm not sure what caused this so I'd greatly appreciate an explanation as well as a possible solution.</p>
  <p>Thank you!</p>