Pages

Senin, 14 Maret 2011

ALPRO :: LARIK/ARRAY


  • CONTOH PROGRAM ::
program contoh_larik;
uses wincrt;        
                                                                                        
const
n=7;

type larik=array[1..n] of integer;

var
l:larik;
jumlah:integer;

procedure input;
var
i:integer;

begin
jumlah:=0;   
for i:=1 to n do
begin
write('          hari ke ',i,' = '); readln(l[i]);
jumlah := jumlah+l[i];
end;
end;

procedure output;
var
i:integer;
begin
writeln(' jumlah barang terjual selama 1 minggu : ');
write(' ',l[1]);
for i:=2 to n do
begin
write(' + ',l[i]);
end;
writeln(' = ',jumlah,' buah');
end;
begin
writeln;
writeln(' ============================================');
writeln('              PENJUALAN BARANG');
writeln(' ============================================');
input;
writeln;                                        
writeln(' ============================================');
output;
writeln(' ============================================');
end.

HASIL

Photobucket
Print Friendly and PDF

Artikel Terkait:

0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...