program menghitung rata-rata, nilai maksimum, nilai minimum

program menghitung_nilai;

uses wincrt;

var x,y,z, jml,maks,min:integer;

mean : real;

begin



writeln(‘===================================’);

writeln(‘= menghitung jumlah rata-rata =’);

writeln(‘= dan nilai maks, min =’);

writeln(‘= dari 3 data =’);

writeln(‘===================================’);

write(‘masukkan data pertama:’); readln(x);

write(‘masukkan data kedua :’); readln(y);

write(‘masukkan data ketiga :’); readln (z);

jml:=x+y+z;

mean:=jml/3;

if x>y then

begin

if ((x>z) and (y>z)) then

begin

maks:=x;

min:=z;

end

else if ((x<z) and (y<z)) then

begin

maks:=z;

min:=y;

end

else

begin

maks:=x;

min:=y;

end

end

else

begin

if ((x>z) and (y>z)) then

begin

maks:=y;

min:=z;

end

else is ((x<z) and (y<z)) then

begin

maks:=z;

min:=x;

end

else

begin

maks:=y;

min:=x;

end

end;

writeln(‘jumlah data =’,jml);

writeln(‘rata-rata =’,mean:1:2);

writeln(‘nilai maksimum =’,maks);

writeln(‘nilai minimum =’,min);

readln;

end.

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: