Решить задачу. Написать программу, которая запрашивает массив из N целых чисел, а затем выводит порядковые номера нулевых элементов массива или сообщение «Нет таких элементов».
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.
//Я просто опишу метод записи матрицы const n=100; var ar:array of array of integer; ars:array of array of string; i:integer;
procedure complection(var ar:array of array of integer;var ars:array of array of string); var i,j:integer; begin; for i:=1 to n do begin; for j:=1 to n do begin; ar[i,j]:=random(9); str(ar[i,j],ars[i,j]); end; end; end;
procedure burning(ars:array of array of string); var i,j:integer; t:text; begin; assign(t,'text.txt'); rewrite(t); for i:=1 to n do begin; writeln(t,' '); for j:=1 to n do write(t,ars[i,j],' '); end; end;
begin; randomize; setlength(ar,n+1); setlength(ars,n+1); for i:=1 to n do begin; setlength(ar[i],n+1); setlength(ars[i],n+1); end; complection(ar,ars); burning(ars); 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.
const n=100;
var ar:array of array of integer;
ars:array of array of string;
i:integer;
procedure complection(var ar:array of array of integer;var ars:array of array of string);
var
i,j:integer;
begin;
for i:=1 to n do
begin;
for j:=1 to n do
begin;
ar[i,j]:=random(9);
str(ar[i,j],ars[i,j]);
end;
end;
end;
procedure burning(ars:array of array of string);
var
i,j:integer;
t:text;
begin;
assign(t,'text.txt');
rewrite(t);
for i:=1 to n do
begin;
writeln(t,' ');
for j:=1 to n do
write(t,ars[i,j],' ');
end;
end;
begin;
randomize;
setlength(ar,n+1);
setlength(ars,n+1);
for i:=1 to n do
begin;
setlength(ar[i],n+1);
setlength(ars[i],n+1);
end;
complection(ar,ars);
burning(ars);
end.