Program Array Mencari Nilai Rata-rata (1)

Posted: 16 Maret 2013 in Pemrograman C++

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <math.h>
main ()
{
const int arraySize = 12;
int n[arraySize];
int total = 0;
cout<<“Jumlah Array hanya : “<<arraySize<<endl;
for (int i=0; i<arraySize; i++)         //i dimulai dari 0 dan berakhir sebelum jumlah (12)
{
cout<<“Data Ke- “<<i<<” Silahkan Masukkan Angka : “;
cin>>n[i];
total = total + n[i];
}
cout<<“Total Nilai : “<<total<<“\n”;
cout<<“Rata-rata : “<<total/arraySize<<“\n”;
getch();
}

Tampilan :
Nilai Rata-rata Jumlah Ditentukan

Komentar
  1. […] Program Array Mencari Nilai Rata-rata (1) […]

  2. […] Program Array Mencari Nilai Rata-rata (1) […]

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s