Jumat, 11 Agustus 2017

[Pascal] Tugas Struktur Data Membuat Program Array 1 Dimensi

[Pascal] Tugas Struktur Data Membuat Program Array 1 Dimensi Dengan Turbo Pascal

Bentuk Soal :
Input : Nama, Tugas, Quiz, UTS, UAS
Proses : Nilai = 10% Tugas, 20% Quiz, 30% UTS, 40% UAS
Output : Nama dan Nilai Ditampilkan Menurut Index

Syntax Turbo Pascal

program array1dpius;
uses crt;
var
  nama : array [1..5] of string;
  tugas, quiz, uts, uas, nilai : array [1..5] of real;
  x : integer;
begin
  for x := 1 to high (nama) do
  begin
    clrscr;
    writeln ('Mahasiswa ke-',x);
    write ('Nama : '); readln (nama[x]);
    write ('Tugas : '); readln (tugas[x]);
    write ('Quiz : '); readln (quiz[x]);
    write ('UTS : '); readln (uts[x]);
    write ('UAS : '); readln (uas[x]);
    nilai [x] := (10/100*(tugas[x])) + (20/100*(quiz[x])) +
    (30/100*(uts[x])) + (40/100*(uas[x])) ;
  end;
  clrscr;
  for x := 1 to high (nama) do
  begin
    writeln (nama[x],' ',nilai[x]:2:1);
  end;
readln;
end.