Pages

Senin, 02 Maret 2020

MENENTUKAN LULUS/TIDAK BERDASARKAN NILAI


MENENTUKAN LULUS/TIDAK BERDASARKAN NILAI

uses wincrt;
var
   NAMA : ARRAY[1..10] OF STRING;
   NILAI : ARRAY[1..10] OF integer;
   KET,NH:STRING;
   X:INTEGER;
   MAX,MIN : INTEGER;
   JUMLAH: INTEGER;
   RATA : REAL;
begin
     NAMA[1]:='JOKO';
     NILAI[1]:=80;

     NAMA[2]:='UDIN';
     NILAI[2]:=90;

     NAMA[3]:='ANI';
     NILAI[3]:=59;

     NAMA[4]:='TOTO';
     NILAI[4]:=30;

     WRITELN(' DATA NILAI : ');
     WRITELN('=============================================');
     WRITELN(' NO  NAMA   NILAI   KETERANGAN ');
     WRITELN('=============================================');

     MAX:=NILAI[1];
     MIN:=NILAI[1];

     JUMLAH:=0;

     FOR X:=1 TO 4 DO
     BEGIN
          IF NILAI[X]>=60 THEN
             KET:='LULUS'
          ELSE
              KET:='GAGAL';


          IF NILAI[X]>=80 THEN
             NH:='A'
          ELSE
              IF NILAI[X]>=70 THEN
                 NH:='B'
              ELSE
                  IF NILAI[X]>=60 THEN
                      NH:='C'
                  ELSE

                      IF NILAI[X]>=40 THEN
                          NH:='D'
                      ELSE
                          NH:='E';

          WRITELN(X:3, NAMA[X]:10,NILAI[X]:4,KET:7,NH:5);

          IF NILAI[X]> MAX THEN
             MAX:=NILAI[X];
          IF NILAI[X]< MIN THEN
             MIN:=NILAI[X];
          JUMLAH:=JUMLAH+NILAI[X];

     END;

      WRITELN('=============================================');
      WRITELN(' NILAI MAX : ',MAX);
      WRITELN(' NILAI MIN : ',MIN);
      RATA:=JUMLAH/4;
      WRITELN(' NILAI RATA-RATA : ',RATA:2:2);

     WRITELN('=============================================');
end.

Tidak ada komentar:

Posting Komentar

Komentarnya ya...