#include <iostream.h>
#include <conio.h>
void main()
{
int n,x;
float d,r,j=0,min,max;
clrscr();
cout << "Ada berapa data ? "; cin >> n;
for(x=1;x<=n;x++)
{
cout << "Data ke-" << x << " : "; cin >> d;
j += d;
if(x==1){
min = max = d;
} else {
if(d<min){
min = d;
}
if(d>max){
max = d;
}
}
}
r = j/n;
cout << "----------------- " << endl;
cout << "Nilai tertinggi = " << max << endl;
cout << "Nilai terendah = " << min << endl;
cout << "rata-rata = " << r << endl;
getch();
}
0 komentar:
Posting Komentar