program operasiaritmatika_array;

uses

WinCrt;  { Allows Writeln, Readln, cursor movement, etc. }

 

var

A,B,C : array[1..5] of Integer;

index,pilihan : Integer;

 

begin

Writeln(‘Operasi Aritmatika dengan array’);

Writeln(‘————————————————‘);

Writeln(‘Nama : indrahimessi’);

Writeln(‘NIM  : xxxxxxxxxx’);

writeln(‘————————————————‘);

writeln;

 

for index := 1 to 5 do

begin

write(‘A’,index,’  =  ‘);

readln(A[index]);

end;

 

writeln;

writeln(‘terima kasih telah menginput nilai array’);

writeln(‘nilai array A anda adalah sebagai berikut :’);

writeln(‘————————————————–‘);

for index := 1 to 5 do

writeln(‘A’,index,’  =  ‘,A[index]);

writeln;

writeln(‘————————————————–‘);

writeln;

 

 

for index := 1 to 5 do

begin

write(‘B’,index,’  =  ‘);

readln(B[index]);

end;

 

writeln;

writeln(‘terima kasih telah menginput nilai array’);

writeln(‘nilai array B anda adalah sebagai berikut :’);

writeln(‘————————————————–‘);

for index := 1 to 5 do

writeln(‘B’,index,’  =  ‘,B[index]);

writeln;

writeln(‘————————————————–‘);

writeln;

writeln;

 

writeln(‘operasi aritmatika’);

writeln(‘————————————————–‘);

writeln(‘1. Penambahan (+)’);

writeln(‘2. Perkalian (*)’);

writeln(‘3. Pengurangan (-)’);

writeln(‘4. Pembagian (/)’);

writeln(‘————————————————–‘);

 

writeln(‘silahkan pilih operasi aritmatika yang anda inginkan’);

write(‘pilihan nomor :’);

readln(pilihan);

 

writeln(‘————————————————–‘);

writeln(‘hasil operasinya adalah sebagai berikut :’);

 

 

if (pilihan = 1) then

for index := 1 to 5 do

begin

C[index] := A[index] + B[index];

end;

 

for index := 1 to 5 do

writeln(‘C’,index,’  =  ‘,C[index]);

 

writeln;

writeln(‘terima kasih telah mencoba’);

 

 

if (pilihan = 2) then

for index := 1 to 5 do

begin

C[index] := A[index] * B[index];

end;

 

for index := 1 to 5 do

writeln(‘C’,index,’  =  ‘,C[index]);

 

writeln;

writeln(‘terima kasih telah mencoba’);

 

 

if (pilihan = 3) then

for index := 1 to 5 do

begin

C[index] := A[index] – B[index];

end;

 

for index := 1 to 5 do

writeln(‘C’,index,’  =  ‘,C[index]);

 

writeln;

writeln(‘terima kasih telah mencoba’);

 

 

if (pilihan = 4) then

for index := 1 to 5 do

begin

C[index] := A[index] div B[index];

end;

 

for index := 1 to 5 do

writeln(‘C’,index,’  =  ‘,C[index]);

 

writeln;

writeln(‘terima kasih telah mencoba’);

 

end.