using namespace std;
int main()
{
int n,i,nilai,tt_nilai=0;
float rata2;
cout <<"Masukkan banyak data : " ;
cin >>n;
for (i=1 ; i<=n ; i++)
{
cout <<"Masukkan Data Nilai : " <<i << " " ;
cin >> nilai;
tt_nilai = tt_nilai + nilai;
}
rata2 = tt_nilai/n ;
cout <<"Nilai rata-rata nya : " <<rata2 ;
system("pause");
return 0;
}
int main()
{
int n,i,nilai,tt_nilai=0;
float rata2;
cout <<"Masukkan banyak data : " ;
cin >>n;
for (i=1 ; i<=n ; i++)
{
cout <<"Masukkan Data Nilai : " <<i << " " ;
cin >> nilai;
tt_nilai = tt_nilai + nilai;
}
rata2 = tt_nilai/n ;
cout <<"Nilai rata-rata nya : " <<rata2 ;
system("pause");
return 0;
}
0 comments:
Post a Comment