contoh program pascal Array


PROGRAM COBA;
USES CRT;
VAR
NM     : ARRAY[1..100] OF STRING[15];
NL    : ARRAY[1..100] OF INTEGER;
X, JD,JML,NMIN,NMAX     : INTEGER;
TANYA     : CHAR;
RATA    : REAL;


BEGIN
X:=0;
REPEAT
X:=X+1;
CLRSCR;
WRITELN('DATA KE                : ', X:3);
WRITE('NAMA SISWA             :');READLN(NM[X]);
WRITE('NILAI                  :');READLN(NL[X]);
WRITELN;
WRITE('MASIH ADA DATA Y/T: ');READLN(TANYA);
UNTIL TANYA='T';
JD:=X;
X:=0;
CLRSCR;
WRITELN('            DAFTAR NILAI');
WRITELN('========================================');
WRITELN(' NO      NAMA SISWA           NILAI');
WRITELN('----------------------------------------');
JML:=0;
NMIN:=NL[1];
NMAX:=NL[1];
REPEAT
X:=X+1;
IF NL[X]<NMIN THEN NMIN:=NL[X];
IF NL[X]>NMAX THEN NMAX:=NL[X];
WRITELN(X:3,NM[X]:15,NL[X]:15);
JML:=JML+NL[X];
UNTIL X=JD;
WRITELN('========================================');
RATA:=JML/JD;
WRITELN('RATA-RATA           : ', RATA:5:2);
WRITELN('NILAI TERTINGGI     : ', NMAX:3);
WRITELN('NILAI TERENDAH      : ', NMIN:3);


READLN;

END.


hasil program ketika dijalankan

Share this article :
 

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. ELEKTRONIK - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger