code untuk paskal...
Uses wincrt;
Const
A : array [1..10] of integer = (75,10,15,12,8,5, 73, 78, 81, 80);
Var
i, x, indeks : integer; ui : char;
begin
repeat
clrscr;
writeln( 'cari angka ');
writeln('____________');
writeln('75,10,15,12,8,5, 73, 78, 81, 80');
writeln;
writeln('================================');
write ('Masukkan nilai yang akan dicari : '); readln(x);
indeks := 0;
for i := 1 to 10 do begin if A[i] = x then begin
indeks := I; end; end;
writeln (x, 'ditemukan pada indeks ke-', indeks);
readln; write
('apakah anda ingin mengulanginya lagi[Y/T] : ');readln(ui); until upcase(ui)<>'Y'; end.
selamat mencoba ...:-)
0 komentar:
Post a Comment