#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n;
float rata;
int jum;
int i;
int x;
cout << "banyak data : ";cin>>n;
jum =0;
for (i=1;i<=n;i++){
cout<<"data ke : "<<i<<"=";cin>>x;
jum +=x;
}
rata = (float) jum/n;
cout<<"Rata raa = "<<rata;
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :