int main() { int data[10] = {5,3,8,9,1,2,0,6,4,7}; int max, min, sum = 0; int index = 0; double avg, var =0; max=min=data[index]; sum=data[index]; index=index+1; while(index <= 9) { if(max < data[index]) max = data[index]; if(min > data[index]) min = data[index];
sum = sum + data[index]; index = index +1; }
avg=(double)sum/index;
cout<<"최대값은 : "<< max <<"입니다."<<endl; cout<<"최소값은 : "<< min <<"입니다."<<endl; cout<<"평균값은 : "<< avg <<"입니다."<<endl;