CONTOH ERAYYY
USES WINCRT;
VAR
I,N :
INTEGER;
NAMA :
ARRAY[1..10] OF STRING[25];
BEGIN
WRITE('JUMLAH DATA ?');READLN(N);
FOR I:= 1 TO N DO
BEGIN
WRITE('NAMA KE-',I,':');READLN(NAMA[I]);
END;
WRITELN('KELUARAN :');
WRITELN('-----------');
FOR I:= 1 TO N DO
BEGIN
WRITELN('NAMA KE-',I,':',NAMA[I]);
END;
READLN;
END.
ALGORITMA
:
1.
INPUT N
2.
I ß 1
3.
SELAMA
I<=N MAKA
INPUT
NAMA[I]
4.
SELAMA I
<=N MAKA
CETAK
NAMA[I]
ATAU
1.
INPUT N
2.
FOR Iß 1 TO N DO
READ(
NAMA[I])
3.
FOR I ß 1 TO N DO
WRITE(NAMA[I])
PSEDEUCODE
:
ALGORITMA
INPUT_NAMA;
{DIGUNAKAN
UNTUK MENERIMA INPUT N NAMA
DAN
MENCETAK}
DEKLARASI :
I,N : INTEGER;
NAMA : ARRAY[1..10] OF STRING[25];
DESKRIPSI
:
READ(N);
FOR I := 1 TO N DO
READ(NAMA[I]);
FOR I := 1 TO N DO
WRITE(NAMA[I]);
NOMOR
2.
PROGRAM
ARRAY2;
USES
WINCRT;
VAR
I,N,JUMLAH : INTEGER;
X: ARRAY[1..10] OF INTEGER;
RATA: REAL;
BEGIN
WRITE('JUMLAH DATA ?');READLN(N);
JUMLAH:=0;
WRITELN('DATA YANG DIINPUTKAN');
FOR I := 1 TO N DO
BEGIN
WRITE('NILAI
KE-',I,':');READLN(X[I]);
JUMLAH:=JUMLAH + X[I];
END;
RATA:=JUMLAH/N;
CLRSCR;
WRITELN('DATA YANG TAMPILKAN');
FOR I := 1 TO N DO
BEGIN
WRITELN('NILAI KE-',I,':',X[I]);
END;
WRITELN('JUMLAH :',JUMLAH);
WRITELN('RATA-RATA :',RATA:4:2);
READLN;
END.
ALGORITMA
:
1.
INPUT N
2.
JUMLAH ß 0
3.
SELAMA
I<= N DO
INPUT
X[I]
JUMLAH ß JUMLAH + X[I]
4.
RATA ß JUMLAH / N
5.
SELAMA
I<= N DO
CETAK
X[I]
6.
CETAK
JUMLAH,RATA
PSEDEUCODE
:
ALGORITMA
HITUNG_JUMLAH_DAN_RATA2;
{DIGUNAKAN
UNTUK MENERIMA INPUT N NILAI DAN MENGHITUNG JUMLAH DAN RATA-RATANYA}
DEKLARASI :
I,N,JUMLAH : INTEGER;
X: ARRAY[1..10] OF INTEGER;
RATA: REAL;
DESKRIPSI
:
READLN(N);
JUMLAH:=0;
FOR I := 1 TO N DO
READLN(X[I]);
JUMLAH:=JUMLAH + X[I];
RATA:=JUMLAH/N;
FOR I := 1 TO N DO
WRITE(X[I]);
WRITE (JUMLAH);
WRITE(RATA);
TABEL OPERASI
MATEMATIKA
--------------------------------------------------------------------
NO. X Y X+Y X*Y X-Y X/Y
--------------------------------------------------------------------
1. 4 2
2. 10 5
3. 6 3
.. 20
N
--------------------------------------------------------------------
ALGORITMA
:
1.
INPUT N
2.
FOR I ß 1 TO N DO
INPUT
X[I],Y[I]
3.
FOR I ß 1 TO N DO
TAMBAH ß X[I] + Y[I]
KURANG ß X[I] -Y[I]
KALIß X[I] * Y[I]
BAGIß X[I] / Y[I]
CETAK
I,X[I],Y[I],TAMBAH, KALI,KURANG, BAGI
ALGORITMA
HITUNG_TABEL_MATEMATIKA;
{DIGUNAKAN
UNTUK MENAMPILKAN TABEL MATEMATIKA
DENGAN INPUTAN N, X, DAN Y}
DEKLARASI :
X,Y : ARRAY[1..10] OF INTEGER;
I,N
: INTEGER;
TAMBAH, KALI, KURANGI : INTEGER;
BAGI : REAL;
DESKRIPSI
:
READLN(N);
FOR
I := 1 TO N DO
READLN(X[I], Y[I]);
FOR
I:= 1 TO N DO
BEGIN
TAMBAH:=X[I] + Y[I];
KALI:=X[I] * Y[I];
KURANGI:=X[I] - Y[I];
BAGI:=X[I] / Y[I];
WRITE(I,X[I], Y[I], TAMBAH, KALI, KURANGI,
BAGI:4:2);
WRITELN(‘------------------------------------------------------------‘);
READLN;
END.
VAR
X,Y : ARRAY[1..10] OF INTEGER;
I,N : INTEGER;
TAMBAH, KALI, KURANGI : INTEGER;
BAGI : REAL;
BEGIN
WRITE(’JUMLAH DATA ?’);READLN(N);
FOR I := 1 TO N DO
BEGIN
WRITELN(‘INPUT DATA
KE-‘,I);
WRITELN(‘---------------------------------‘);
WRITE(‘NILAI X
:’);READLN(X[I]);
WRITE(‘NILAI Y
:’);READLN(Y[I]);
END;
WRITELN(‘ TABEL OPERASI
MATEMATIKA ‘);
WRITELN(‘------------------------------------------------------------‘);
WRITELN(’NO. X Y X+Y X*Y X-Y
X/Y ‘);
WRITELN(‘------------------------------------------------------------‘);
FOR I:= 1 TO N DO
BEGIN
TAMBAH:=X[I] + Y[I];
KALI:=X[I] * Y[I];
KURANGI:=X[I] - Y[I];
BAGI:=X[I] / Y[I];
WRITELN(I,’ ‘,X[I],’
‘,Y[I],’ ‘,TAMBAH,’ ‘,
KALI,’ ‘,KURANGI,’ ‘,BAGI:4:2);
END;
WRITELN(‘------------------------------------------------------------‘);
READLN;
END.
DAFTAR NILAI MAHASISWA
--------------------------------------------------------------------------------------------
NO. NIM NAMA QUIZ UTS
UAS NA GRADE
--------------------------------------------------------------------------------------------
1.
2.
3.
..
N
-------------------------------------------------------------------------------------------
BOBOT
NILAI AKHIR (NA) = QUIZ 20%, UTS 30%, UAS 50%
GRADE = 86 – 100 =A;71 -85 =B;
56 – 70=C;41-55=D;0 – 40=E;
SEMOGA BER MANFAAT..................