#include <iostream.h>
#include <conio.h>
main() {
int i, n, jumlah, x;
float rata;
cout << "Banyak data : "; cin >> n;
jumlah = 0;
for (i = 1; i<=n; i++) {
cout << "Data ke- : " << i; cin >> x;
jumlah += x;
}
rata = (float) jumlah/n;
cout << "Rata-rata = " << rata;
getch ();
return 0;
}
Hasil: