任意给定n个整数,求这n个整数序列的和、最小值和最大值。
#include<stdio.h>
int main(){
int n,i=1,m=0,sum=0,max=0,min=0;
printf("Please input the number of the integers:");
scanf("%d",&n);
printf("Please input the integers:");
scanf("%d",&m);
sum=max=min=m;
while(i<n){
scanf("%d",&m);
sum=sum+m;
i++;
if(m>max){
max=m;
}
if(m<min){
min=m;
}
}
printf("The total,maximum and minimum of the integers are:%d %d %d",sum,max,min);
return 0;
}