Monday, May 24, 2010

Array pada Pascal

Posted on 9:32 PM by Agazhw

Listing Program:
program daftar_nilai;
uses crt;
var i:integer; nama,npm,ket:array[1..3] of string; nA:array[1..3] of real; uts,uas:array[1..3] of integer;
begin
          clrscr;
          for i:=1 to 3 do
          begin
                    write('Masukkan Nama Anda: ');readln(nama[i]);
                    write('Masukkan NPM Anda: ');readln(npm[i]);
                    write('Masukkan Nilai UTS Anda: ');readln(uts[i]);
                    write('Masukkan Nilai UAS Anda: ');readln(uas[i]);
                    nA[i] := (uas[i] + uts[i]) / 2;
                    clrscr;
          end;
          clrscr;
          for i:=1 to 3 do
          begin
          if nA[i] < 60 then ket[i]:='gagal' else ket[i]:='lulus';
          end;
writeln('================================================================');
writeln('no':3,'nama':10,'npm':10,'uts':10,'uas':10,'keterangan':20);
writeln('================================================================');
for i:=1 to 3 do
begin
writeln(i:3, nama[i]:10, npm[i]:10, uts[i]:10, uas[i]:10, ket[i]:15);
end;
readln;
end.

No Response to "Array pada Pascal"

Leave A Reply