Selasa, 01 Juni 2010
contoh program pascal.
PROGRAM DEALER;
USES CRT;
VAR
J :integer;
JM : INTEGER;
m :string;
H,D,HB: REAL;
pot,tot: real;
BEGIN
CLRSCR;
WRITELN('PILIH JENIS MOBIL YANG AKAN DIBELI :');
WRITELN('1.BMW');
WRITELN('2.Mercedes Benz');
write('Pilih Salah Satu,1 atau 2:');readln(j);
if (j=1) then
begin
writeln('jumlah mobil yang anda pesan :');readln(jm);
h:=470000000;
m:='bmw';
if(jm>5) then
begin
pot:=(0.07*h)*jm;
tot:=(h*jm)-pot;
end
else
begin
pot:=(0.05*h)*jm;
Tot:=(h*jm)-pot;
end
end;
if (j=2) then
begin
writeln('jumlah mobil yang anda pesan :');readln(jm);
h:=530000000;
m:='M.benz';
if(jm>5) then
begin
pot:=(0.07*h)*jm;
tot:=(h*jm)-pot;
end
else
begin
pot:=(0.05*h)*jm;
Tot:=(h*jm)-pot;
end
end;
writeln('anda membeli mobil jenis',m,' dengan jml ',jm);
writeln('total potongan:',pot:15:2,'dan total harga rp. ',tot:15:2);
readln;
end.
USES CRT;
VAR
J :integer;
JM : INTEGER;
m :string;
H,D,HB: REAL;
pot,tot: real;
BEGIN
CLRSCR;
WRITELN('PILIH JENIS MOBIL YANG AKAN DIBELI :');
WRITELN('1.BMW');
WRITELN('2.Mercedes Benz');
write('Pilih Salah Satu,1 atau 2:');readln(j);
if (j=1) then
begin
writeln('jumlah mobil yang anda pesan :');readln(jm);
h:=470000000;
m:='bmw';
if(jm>5) then
begin
pot:=(0.07*h)*jm;
tot:=(h*jm)-pot;
end
else
begin
pot:=(0.05*h)*jm;
Tot:=(h*jm)-pot;
end
end;
if (j=2) then
begin
writeln('jumlah mobil yang anda pesan :');readln(jm);
h:=530000000;
m:='M.benz';
if(jm>5) then
begin
pot:=(0.07*h)*jm;
tot:=(h*jm)-pot;
end
else
begin
pot:=(0.05*h)*jm;
Tot:=(h*jm)-pot;
end
end;
writeln('anda membeli mobil jenis',m,' dengan jml ',jm);
writeln('total potongan:',pot:15:2,'dan total harga rp. ',tot:15:2);
readln;
end.
Langganan:
Postingan (Atom)