#include<stdio.h>
main()
{
int a, input[1000];
int choice;
int num,max,low;
double total=0,average;
int array[1000];
clrscr();
start:
clrscr();
printf("\n ******** MENU **********\n");
printf(" [1] Input as many numbers as the user like and ends getting of numbers when -1 is inputted.\n");
printf(" [2] Getting the largest, lowest and average in a list of numbers.\n");
printf(" Enter choice : ");
scanf("%d", &choice);
if(choice==1)
{
clrscr();
for(a=0;a<1000;a++)
{
printf("Enter number : ");
scanf("%d",&input[a]);
if(input[a]==-1)
{
goto start;
getch();
}
}
}
if(choice==2)
{
clrscr();
printf("Enter number of list :");
fflush(stdin);
scanf("%d",&num);
for(a=0;a<num;a++)
{
printf("Enter number:");
scanf("%d",&array[a]);
if (a==0)
{
max=array[a];
low=array[a];
}
if(array[a]>max)
max=array[a];
if(array[a]<low)
low=array[a];
total+=array[a];
}
average=total/num;
fflush(stdout);
printf("LOWEST = %d.\n",low);
printf("LARGEST = %d.\n",max);
printf("AVERAGE = %lf.\n",average);
}
getch();
return 0;
}