- 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
0 komentar:
Posting Komentar