Posted by Materi Teknik Informatika • Informasi Teknologi Informasi • Digital Marketing on 9/20/2014
/*Program Menghitung Total Bilangan Nilai Rata Rata*/
#include <iostream.h>
#include <conio.h>
void main()
{
cout<<"Program Menghitung Nilai Rata Rata Sesuai Keinginan"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
int n,bil,total=0,data,rata;
cout<<"Banyak Data : ";
cin>>data;
for(n=1;n<=data;n=n+1)
{
cout<<"Bilangan Ke "<<n<<" : ",cin>>bil;
total=total+bil;
}
rata=total/data;
cout<<"========================================================================="<<endl;
cout<<"Total Bilangan = "<<total<<endl;
cout<<"Nilai Rata Rata : "<<rata<<endl;
getch();
}
Berikut hasil output Program Menghitung Total Bilangan Nilai Rata Rata yang dihasilkan.