#include<stdio.h>
int main()
{
int i;
double sum=0;
int n=0;
scanf("%d",&i);
while(i!=-1)
{
sum+=i;
n++;
scanf("%d",&i);
}
printf("%.2f",sum/n);
return 0;
}
运行结果为;
#include<stdio.h>
int main()
{
int i;
double sum=0;
int n=0;
scanf("%d",&i);
while(i!=-1)
{
sum+=i;
n++;
scanf("%d",&i);
}
printf("%.2f",sum/n);
return 0;
}
运行结果为;