#include<stdio.h>
main()
{
int n,m;
float ave,t;
t=0;
n=0;
clrscr();
printf("This program averages a list of integers/n");
printf("Enter -1 to signal the end of the list./n");
while(1)
{
printf("?");
scanf("%d",&m);
if(m==-1) break;
t+=m;
n++;
}
ave=t/n;
printf("The average is %g",ave);
getch();
}
main()
{
int n,m;
float ave,t;
t=0;
n=0;
clrscr();
printf("This program averages a list of integers/n");
printf("Enter -1 to signal the end of the list./n");
while(1)
{
printf("?");
scanf("%d",&m);
if(m==-1) break;
t+=m;
n++;
}
ave=t/n;
printf("The average is %g",ave);
getch();
}