Array

15 03 2010

Program 1 :

uses crt;
var
bil : array[1..50] of integer;
begin
clrscr;
bil[1]:=3;
bil[2]:=20;
bil[3]:=29;
bil[4]:=33;
bil[5]:=15;
writeln(‘Nilai bilangan ke-3=’,bil[3]);
readln;
end.

Program 2 :

uses crt;
var
nama : array[1..50] of string;
npm : array[1..50] of string;
umur : array[1..50] of string;
banyak,i:integer;
begin
clrscr;
write(‘Banyaknya data:’);
readln(banyak);
for i:=1 to banyak do
begin
writeln(‘Data ke-‘,i);
write(‘Nama :’);readln(nama[i]);
write(‘NPM :’);readln(npm[i]);
write(‘Kelas:’);readln(umur[i]);
writeln;
end;
writeln(‘====================’);
writeln(‘Nama NPM KELAS ‘);
writeln(‘====================’);
for i:= 1 to banyak do
begin
writeln(nama[i],’ ‘,npm[i],’ ‘,umur[i]);
end;
writeln(‘=====================’);
readln;
end.


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: