uses wincrt;
var x : array[1..3] of string;
a : integer;
begin
for a := 1 to 3 do begin
write('input ', a, ' : ');
readln(x[a]);
end;
writeln;
write('output : ');
for a := 1 to 3 do
write(x[a],' ');
end.
uses wincrt;
var genap : array[1..100] of integer;
a, b, jum : integer;
begin
a := 0;
b := 2;
write('Jumlah bilangan genap : ');readln(jum);
while a <> jum do begin
inc(a);
genap[a] := b;
b := b + 2;
end;
writeln;
writeln('Hasil yang disimpan di array : ');
for b := 1 to jum do
writeln('Bilangan genap ke-',b,' : ',genap[b]);
end.
Var Nama : String
Nilai : Char
program aljan;
Uses winCrt;
Var
nil1 : Array[1..100] of Integer;
n,i,j,dum : Integer;
Begin
ClrScr;
Write('mau isi berapa data acak (integer) ='); readln(n);
For i := 1 to n Do
Begin
Write('Data Ke ',i,':');Readln(nil1[i]);
End;
{* penyapuan proses}
for i:= 1 to n-1 do
begin
for j:= i to n do
begin
if nil1[j]
begin
dum:=nil1[j];
nil1[j]:=nil1[i];
nil1[i]:=dum;
end;
end;
end;
writeln;
writeln('Hasil Sortir');
for i := 1 to n do
write(nil1[i]:3);
readln;
end.
uses wincrt;
type
Mahasiswa = Record
Nama :string[30];
NIM :string[10];
Alamat :string[50];
end;
var
mhs:Mahasiswa;
Begin
clrscr;
write('Nama : ');readln(Mhs.Nama);
write('NIM : ');readln(Mhs.NIM);
write('Alamat : ');readln(Mhs.Alamat);
writeln;
writeln('Nama Anda : ',Mhs.Nama);
writeln('NIM Anda : ',Mhs.NIM);
writeln('Alamat Anda : ',Mhs.Alamat);
end.
USES WINCRT;
TYPE DATA = RECORD
NAMA : STRING[25];
ALAMAT : STRING[30];
JK : STRING ;
TELP : STRING [10];
TANGGALLAHIR : STRING[20] ;
END;
VAR
a : data;
JAWABAN : CHAR;
BEGIN
REPEAT
CLRSCR;
BEGIN
WRITE ('NAMA :');READLN(a.NAMA);
WRITE ('ALAMAT :');READLN (a.ALAMAT);
WRITE ('JK ;');READLN (a.JK);
WRITE ('TELP :');READLN (a.TELP);
WRITE ('TANGGAL LAHIR :');READLN (a.TANGGALLAHIR);
WRITELN;
WRITELN('NAMA ANDA :',a.NAMA);
WRITELN ('ALAMAT ANDA : ',a.ALAMAT);
WRITELN ('JK :',a.JK);
WRITELN ('TELP :',a.TELP);
WRITELN ('TANGGAL LAHIR :', a.TANGGALLAHIR);
WRITELN ('APAKAH ANDA AKAN ENTRI DATA LAGI(Y/T):');
READLN(JAWABAN);
end;
UNTIL (JAWABAN='T');
end.
program arrayku;
uses wincrt;
var angka:array[1..100] of integer;
i,n:integer;
begin
clrscr;
writeln('Jumlah data : ');readln(n);
for i:=1 to n do
begin
writeln('Masukkan angka ke-',i,':');readln(angka[i]);
end;
writeln;
for i:=1 to n do writeln('Angka ke-',i,':',angka[i]);
End.
Program Mencari_Bilangan_Prima_Dengan_Array;
Uses Crt;
Var
Prima : Array[1..100] of Integer;
i,j : Integer;
bil : Integer;
Begin
ClrScr;
For i := 2 to 100 Do
Begin
Prima[i]:=i;
For j:= 2 to i-1 Do
Begin
bil := (i mod j); {* i dibagi j dicek apakah 0*}
If bil = 0 then Prima[i]:=0; {*jika habis dibagi,berarti bkn prima*}
End;
If Prima[i] <> 0 Then Write(Prima[i],' '); {*cetak array yg prima*}
End;
Readln;
End.
Tidak ada komentar:
Posting Komentar
terimakasih aras kunjungan anda di blog mesujiraya
komentarnya saya tunggu mas bro & mbak sist