sample.pas

 {Global Variables}
const MAX=10;

var a: array[1..MAX] of integer;
b: integer;
i:integer;
j:integer;
temp: integer;

function Prime(v: integer): integer;
var t:Integer;
begin
t:= v div 2;
while v mod t >0 do
begin
t:=t-1;
end;
if t =1 then
begin
Prime:=1;
end
else
        begin
Prime:=0;
end;
end;

function nd(v: integer):integer;
var i :integer;
cnt:integer;
begin
cnt:=0;
i:=2;
while i<v do
begin
if (v mod i)=0 then
cnt:=cnt+1;
i:=i+1;
end;
nd:=cnt;
end;

procedure print;
begin
for i:=1 to MAX do
begin
write('Element No ',i);
writeln(' :',a[i]);
temp:= nd(a[i]);
if temp > 1 then
if prime(temp)=1 then
writeln(' OK: ', a[i] );
end;
end;


begin
for i:=1 to MAX do
begin
writeln('Enter Element No ',i);
read(a[i]);
end;

for i:=1 to MAX-1 do
for j:=MAX -1 downto i do
begin
if a[j] > a[j+1] then
begin
temp:=a[j];
a[j]:=a[j+1];
a[j+1]:=temp;
end;
end;
print;

end.

Project Homepage: