0% found this document useful (0 votes)
11 views3 pages

Hari Fitri

The document contains two programming code examples. The first example is a program that stores fruit data such as quality, weight, price per kg, and total price in an array of records. The second example is a program that stores integer values in a two-dimensional array and displays the stored data.

Uploaded by

Ifit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Hari Fitri

The document contains two programming code examples. The first example is a program that stores fruit data such as quality, weight, price per kg, and total price in an array of records. The second example is a program that stores integer values in a two-dimensional array and displays the stored data.

Uploaded by

Ifit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

NAMA : HARI FITRI

NIM : C2255201041

1.
program UAS17Des22_1;
uses crt;
type
buah = record
kualitas : string;
hargakilo,berat : integer;
total : longint;
end;
var
data : array[1..50] of buah;
i,a,b : integer;
pilihan : char;
begin
clrscr;
a:= 1;
b:= 1;
while b = a do
begin
with data[b] do
begin
writeln('SILAHKAN ISI DATA DIBAWAH');
writeln;
write('kualitas/A,B,C = '); readln(kualitas);
write('berat/Kg = '); readln(berat);
case kualitas of
'A' : hargakilo:= 10000;
'B' : hargakilo:= 15000;
'C' : hargakilo:= 25000;
end;
total:= berat * hargakilo;
end;
writeln;
write('APAKAH DATA SUDAH CUKUP? [Y]A/[N]O ='); readln(pilihan);
if pilihan = 'N' then
begin
b:= b + 1;
a:= a + 1;
end
else
if pilihan = 'Y' then
begin
writeln('selesai ');
a:= a + 1;
end;
end;
clrscr;
writeln('No kualitas harga per kilo jumlah total harga
');
for i:=1 to b do
begin
with data[i] do
begin
writeln(i,' ',kualitas,' ',hargakilo,'
',berat,' ',total);
end;
end;
readkey;
end.

2.
program UAS17Desm22_2;
uses crt;

var
data : array[1..5, 1..5] of integer;
i,j,baris,kolom : integer;

begin
clrscr;
baris:= 5;
kolom:= 5;
writeln('Banyak Baris ada ',baris,' baris');
writeln('Banyak Kolom ada ',kolom,' kolom');
writeln('Tekan ENTER ');
readln;
clrscr;
writeln('isi data');
for i:= 1 to baris do
begin
for j:= 1 to kolom do
begin
write('data baris ke-',i,' dan kolom ke-',j,' = '); readln(data[i,j]);
end;
end;
clrscr;
writeln(' menampilkan');
for i:= 1 to baris do
begin
for j:= 1 to kolom do
begin
write(data[i,j]:5);
end;
writeln;
end;
readkey;
end.

You might also like