#include "stdio.h"
int main()
{
int n,i=0;
double num,sum=0,ave=0,max,min;
printf("一共有多少个数:");
scanf("%d",&n);
printf("请输入%d个数:\n",n);
scanf("%lf",&num);
max=min=num;
sum+=num;
for(i=1;i { scanf("%lf",&num); if(num>max) max=num; if(num min=num; sum+=num; } ave=sum/n; printf("输入的%d个数中,最大值为%.2lf,最小值为%.2lf,和为%.2lf,平均值为%.2lf\n",n,max,min,sum,ave); }
#include "stdio.h"
int main()
{
float d,max,min,sum,n;
printf("输入一组数,以非数字结束:\n");
n=0;
sum=0;
while(scanf("%f",&d)>0)
{
if(n==0)
{
max=d;
min=d;
}
if(max if(min>d) min=d; sum+=d; n=n+1; } printf("最大数是:%.2f\n",max); printf("最小数是:%.2f\n",min); printf("和是:%.2f\n",sum); printf("平均数是:%.2f\n",sum/n); }