//
baca
Mathematics, TIK

Pascal: menghitung nilai rata-rata

coba dulu deh…

PROGRAM INI;
uses crt;
var a,i,data,nilai,total:integer;
rata2:real;
lagi:char;

BEGIN
lagi:=’Y’;
while lagi=’Y’ DO
begin
clrscr;
writeln(‘Menghitung Nilai Rata-Rata’);
writeln(‘==========================’);
writeln;

writeln(‘===========================================’);
write(‘Masukan banyak data nilai ada berapa ? : ‘);readln(data);
writeln(‘===========================================’);
total:=0;
i:=0;
while i<data do

begin
i:=i+1;
write(‘Nilai data ke ‘,i,’ = ‘);readln(nilai);
total:=total+nilai;
writeln(‘========================================’);

end;
rata2:=total/data;
writeln;
writeln(‘Total Nilai = ‘,total);
writeln(‘Jumlah data = ‘,data);
writeln(‘Rata-Rata nilai = ‘,rata2:2:2);
writeln;
writeln;
writeln;
writeln(‘apakah anda ingin menghitung lagi (Y/T > huruf kapital) ??’);readln(lagi);
end;
end.

About wayanbawa

just an ordinary gen..

Diskusi

Belum ada komentar.

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

%d blogger menyukai ini: