Tuesday, 17 April 2012

C + + program to find the average value

#include <iostream>

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;

}

0 comments:

Post a Comment

.

.

.

.
Design by BlogSpotDesign | Ngetik Dot Com