title: How do I subtract multiple inputted numbers in a loop?
body: <p>The program should collect inputted numbers from the user through a loop (10 maximum numbers) and breaks if the user enters a negative number. After collecting input, it should calculate the sum, difference, product, and quotient. My problem is that I do not know the right way to find the difference, I know this since the answer from the calculator is different from the program's.</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
  int i;
  double number, sum = 0.0, difference = 0, product = 1, quotient = 1;
  
  for (i = 1; i &lt;= 10; ++i) {
    printf(&quot;Enter n%d: &quot;, i);
    scanf(&quot;%lf&quot;, &amp;number);
  
    // if the user enters a negative number, break the loop
    if (number &lt; 0.0) {
       break;
    }
  
    sum += number; // sum = sum + number;
    difference = number;
    product *= number;
    quotient = number / quotient;
  }
  
  printf(&quot;Sum = %.2lf&quot;, sum);
  printf(&quot;\nDifference = %.2lf&quot;, difference);
  printf(&quot;\nProduct = %.2lf&quot;, product);
  printf(&quot;\nQuotient = %.2lf&quot;, quotient);
  
  return 0;
  }
  </code></pre>