Function prime(x:integer):boolean; var t:boolean; d:integer; begin t := true; d := 2; while t and (d*d <= x) do begin if x mod d = 0 then t := false; d := d + 1 end; prime := t end;
function order(x:integer):boolean; var t:boolean; d:integer; begin d := -1; repeat t := x mod 10 > d; d := x mod 10; x := x div 10 until not t or (x = 0); order := t end;
var t:boolean; i,k,n:integer; begin t := false; read(k,n); for i := k to n do if prime(i) then if order(i) then begin write(i,' '); t := true end; if not t then write(0) end.
var
t:boolean;
d:integer;
begin
t := true;
d := 2;
while t and (d*d <= x) do
begin
if x mod d = 0 then
t := false;
d := d + 1
end;
prime := t
end;
function order(x:integer):boolean;
var
t:boolean;
d:integer;
begin
d := -1;
repeat
t := x mod 10 > d;
d := x mod 10;
x := x div 10
until not t or (x = 0);
order := t
end;
var
t:boolean;
i,k,n:integer;
begin
t := false;
read(k,n);
for i := k to n do
if prime(i) then
if order(i) then
begin
write(i,' ');
t := true
end;
if not t then
write(0)
end.
public static void main(String args[]){
String fileName = "Array.txt", aNum = ""; int nArray[] = new int[201], iChar; nArray[0] = 0; long rMulti;
java.io.FileReader iFile = null; java.io.FileWriter oFile = null;
try{
iFile = new java.io.FileReader(fileName);
while((iChar = iFile.read())!=-1)
if(iChar!=' ')aNum+=(char)iChar;
else {nArray[++nArray[0]] = new Integer(aNum);aNum="";}
if(!aNum.equals(""))nArray[++nArray[0]] = new Integer(aNum);
oFile = new java.io.FileWriter(fileName);
for(rMulti = 1; nArray[0]>0; nArray[0]--)rMulti*=nArray[nArray[0]];
oFile.write(rMulti+"");
}catch(java.io.FileNotFoundException fnfe){
System.out.println("Файл не был найден!");
}catch(java.io.IOException ioe){
System.out.println("Ошибка ввода/вывода в файл!");
}finally{
try{
iFile.close(); oFile.close();
}catch(java.io.IOException ioe){
System.out.println("Ошибка закрытия файла ввода/вывода!");
}
}
}
}