uses crt;
var a:array[1..100] of integer;
n,i,d,t: integer;
cn: byte;
procedure nhap;
begin
writeln(' => Nhap mang tu ban phim <= ');
write('Nhap so phan tu: '); readln(n);
for i:= 1 to n do
begin
write('Phan tu thu ',i,' = '); readln(a[i]);
end;
end;
procedure xuat;
begin
writeln(' => Xuat mang ra man hinh <= ');
for i:= 1 to n do write(a[i]:
;
end;
procedure snt;
function ktnt(n:integer):boolean;
begin
d:= 0;
for i:= 1 to n do if n mod i = 0 then inc(d);
if d=2 then ktnt:= true else ktnt:= false;
end;
begin
writeln(' => Xuat ra man hinh cac so nguyen to trong mang <=');
for i:= 1 to n do if ktnt(a[i]) then write(a[i]:
;
end;
procedure shh;
function kthh(n:integer):boolean;
begin
t:= 0;
for i:= 1 to n-1 do if n mod i = 0 then t:= t+i;
if t=n then kthh:= true else kthh:= false;
end;
begin
writeln(' => Xuat ra man hinh cac so hoan hao <= ');
for i:= 1 to n do if kthh(a[i]) then write(a[i]:
;
end;
procedure thoat;
begin
if cn=5 then writeln(' => Thoat <= ');
writeln(' Nhan phim <Enter> de ket thuc chuong trinh ');
end;
begin
clrscr; textmode(co80); textcolor(green);
writeln('*-*-*-* CHUONG TRINH THAO TAC VOI MANG *-*-*-*');
writeln(' 1 Nhap mang tu ban phim');
writeln(' 2 Xuat mang ra man hinh');
writeln(' 3 Xuat ra man hinh cac so nguyen to trong mang');
writeln(' 4 Xuat ra man hinh cac so hoan hao trong mang');
writeln(' 5 Thoat');
repeat writeln('--------------------------------------------------');
write('Moi chon chuc nang: '); readln(cn);
case cn of
1: nhap;
2: thoat;
3: snt;
4: shh;
end;
until cn>4;
thoat;
readln
end.