Translate

Jumat, 03 Mei 2013

Tugas Pascal Array


program barang;
uses crt;
var
   kd : array [1..50] of string[10];
   nama : array [1..50] of string[20];
   quantity : array [1..50] of real;
   harga: array [1..50] of real;
   tot : array [1..50] of real;
   a, b, c:integer;
   total : real;
begin
total:= 0:
clrscr;
write('Input berapa barang = '); readln(a);
for b := 1 to a do
    begin
         write(' Kode Barang = '); readln(kd[b]);
         write(' Nama Barang = '); readln(nama[b]);
         write(' Quantity = '); readln(quantity[b]);
         write(' Harga Satuan = '); readln(harga[b]);
         tot[b] := quantity[b] * harga[b];
         total:=total+ tot[b];
         writeln;
    end;
garis;
writeln('Kode Barang    Nama Barang       Quantity     Harga Satuan    Total Harga');
for c := 1 to a do;
writeln(kd[c]:5 , nama[c]:10, quantity[c]:20:0, harga[c]:10:0, tot[c]:13:0);
garis;
writeln('Total Harga = ', total:10:0);
readln;
end.

JANGAN LUPA FOLLOW BLOG ANE sebagai imbalannya :p

0 komentar:

Posting Komentar