TUGAS STRUKTUR DATA 2
program pengembalian_uang_belanja;
uses wincrt;
var
kode,nama,brg:string[50];
hrg,jumlahbrg,uang,tot,byr: longint;
barang:array[1..50]of integer;
begin
clrscr;
write('Nama Pembeli : ');readln(nama);
writeln;
writeln(' PEMBELIAN ');
writeln(' ----------------------------------');
write(' Kode Barang : ');readln(kode);
write(' Nama Barang : ');readln(brg);
write(' Harga Satuan Barang : ');readln(hrg);
write(' Jumlah : ');readln(jumlahbrg);
writeln;
tot:=hrg*jumlahbrg;
clrscr;
writeln('Balis dwi wahyudi');
writeln('111221098');
writeln;
writeln('Nama Pembeli : ',nama);
writeln('========================================================================');
write('| Kode barang | ');
write('Nama Barang | ');
write('satuan(Rp) | ' );
write('jumlah | ' );
write('harga n jumlah(Rp) |');
writeln;
writeln('========================================================================');
begin
writeln;
write(' ',kode,' ');
write(' ',brg:10,' ');
write(' ',hrg:10,' ');
write(' ',jumlahbrg,' ');
write(tot:10);
end;
writeln;
writeln('========================================================================');
write('Uang Pembayaran : ');readln(byr);
uang:=byr-tot;
writeln;
writeln('Uang Kembalian');
writeln('------------------------------------------------------------------------');
if uang div 100000 > 0 then begin
writeln(uang div 100000, ' lembar seratus ribuan');
uang := uang mod 100000;
end;
if uang div 50000 > 0 then begin
writeln(uang div 50000, ' lembar lima puluh ribuan');
uang := uang mod 50000;
end;
if uang div 20000 > 0 then begin
writeln(uang div 20000, ' lembar dua puluh ribuan');
uang := uang mod 20000;
end;
if uang div 10000 > 0 then begin
writeln(uang div 10000, ' lembar sepuluh ribuan');
uang := uang mod 10000;
end;
if uang div 5000 > 0 then begin
writeln(uang div 5000, ' lembar lima ribuan');
uang := uang mod 5000;
end;
if uang div 1000 > 0 then begin
writeln(uang div 1000, ' lembar ribuan');
uang := uang mod 1000;
end;
if uang div 500 > 0 then begin
writeln(uang div 500, ' lembar lima ratusan');
uang := uang mod 500;
end;
if uang div 100 > 0 then begin
writeln(uang div 100, ' ratusan');
uang := uang mod 100;
end;
if uang div 50 > 0 then begin
writeln(uang div 50, ' limapuluhan');
uang := uang mod 50;
end;
if uang > 0 then begin
writeln(uang, ' satuan');
end;
writeln('=======================================================================');
end.
inilah hasil program di atas
MARI JG AKHIRNYA
BalasHapus