Jumat, 19 April 2013
Posts by : Admin
Contoh Program Pascal Pembelian Produk Susu
Biasanya ketika membeli susu, harganya pasti berbeda-beda sesuai dengan merek dan ukurannya. Nah berikut ini adalah contoh program pascal untuk pembelian susu :
Program Pembelian;
Uses wincrt;
Var
harga,n:integer;
size,tm:char;
Begin
Write('pilih type merk susu [D/I/M] :');readln(tm);
case tm of
'D':begin
writeln('DANCOW');
write('B/S/K :');readln(size);
write('Banyaknya :');readln(n);
if size='B' then
begin
harga:=10000*n;
writeln('Total harga :',harga);
end
else if size='S' then
begin
harga:=4250*n;
writeln('Total harga :',harga);
end
else if size='K' then
begin
harga:=2100*n;
writeln('Total harga :',harga);
end
end;
'I':begin
writeln('INDOMILK');
write('B/S/K :');readln(size);
write('Banyaknya :');readln(n);
if size='B' then
begin
harga:=8500*n;
writeln('Total harga :',harga);
end
else if size='S' then
begin
harga:=4000*n;
writeln('Total harga :',harga);
end
else if size='K' then
begin
harga:=2025*n;
writeln('Total harga :',harga);
end
end;
'M':begin
writeln('MILO');
write('B/S/K :');readln(size);
write('Banyaknya :');readln(n);
if size='B' then
begin
harga:=7750*n;
writeln('Total harga :',harga);
end
else if size='S' then
begin
harga:=3750*n;
writeln('Total harga :',harga);
end
else if size='K' then
begin
harga:=2200*n;
writeln('Total harga :',harga);
end
end;
end;
end.
Program dan flowchart dapat didownload DI SINI
Langganan:
Posting Komentar (Atom)
You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "
0 komentar:
Posting Komentar