Input 99999 to stop

clarence_cool03 0 Tallied Votes 214 Views Share

{-='Input 99999 to stop using Dev-C LaNGuaGe'=-}

#include <stdio.h>

int main(void)
{
//  Local Declarations
    int integer, x, y = 99999, smallest =1;
    int largest =1, number, no_integers;
    int sum=0, total=0, count =1;
    float average;
    
//  Statements
	printf("Enter your numbers: <99999> to stop.\n");
	while (scanf("%d", &x))
       {
        if (x!=99999 && x!=0)
       {
          sum += x;
          count++;
       
          no_integers = count;
       if (x > largest)
          largest = x;
       if (smallest > x)
            smallest = x;
       }// if
       
       if (x == y)
          break;
       }// if
       
    average = sum / count;
    printf("The sum is:%d\n", sum);
    printf("The average is:%.2f\n", average);
    printf ("The largest is:%d\n",largest);
    printf("The Smallest is:%d\n", smallest);
    printf("The number of integers is:%d", no_integers); 
          
    system("pause");
    return 0;              
}// main