title: Inputing multiple doubles on a single line in c using scanf and loops without array
body: <p>My program is suppose to read multiple inputs and display the min, max, sum and the average.  It is supposed to look like this:</p>
  
  <p>Input: </p>
  
  <pre><code>2.5 5 3.5 4.5 jfkjk
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>min is 2.5
  max is 5
  sum is 15.5
  average is 3.875
  </code></pre>
  
  <p>The program is supposed to quit when it reaches a non-number or a newline. The user can input as many numbers as they like. I cannot use arrays and must use loops.
  This is what my program looks like:</p>
  
  <pre><code>void numbers()
        {
        double digit;
        double sum = 0;
        double avg = 0;
        double max;
        double min;
        unsigned count = 0;
        //int c;
        max = 0;
        printf("Input:");
  
        do {
            scanf("%lf", &amp;digit);
  
            min = digit;
            if(max &lt; digit)
                digit = max;
            if(min &lt; digit)
                digit = min;
            sum += digit;
            count++;
            avg = sum/count;
        } while( scanf("%lf", &amp;digit)==1 )
  
        printf(" min is %lf max is %lf sum is %lf avg is %lf count is %u", min, max, sum, avg, count);
        }
  </code></pre>
  
  <p>prints out:</p>
  
  <pre><code>Input:2.2 2.3 5 3.5 blah 
   min is 3.500000 max is 0.000000 sum is 0.000000 avg is 0.000000 count is 4
  </code></pre>