1) const n=10; var a:array[1..n] of integer; i,min,s:integer; begin for i:=1 to n do begin a[i]:=random(81)+10; write(a[i]:4); end; writeln; min:=a[1]; for i:=1 to n do begin if a[i]<min then min:=a[i]; s:=s+a[i]; end; writeln('min = ',min); writeln('s = ',s); end.
Пример: 54 58 67 78 58 79 54 78 44 60 min = 44 s = 630
2) const n=9; m=6; var a:array[1..n,1..m] of integer; i,j:integer; begin for i:=1 to n do for j:=1 to m do a[i,j]:=i; for i:=1 to n do begin for j:=1 to m do write(a[i,j]); writeln; end; end.
Program n1; var k,n,i: longint; co: byte; function simply(a: longint ):boolean; var i: longint; begin simply:=true; for i:=2 to trunc(sqrt(a)) do begin if a mod i=0 then begin simply:=false; break end end end; function cr(a: longint): boolean; var n: longint; begin n:=a; cr:=false; repeat n:=n div 10; until n mod 10 =n; if n=(a mod 10) then begin cr:=true; end; end; begin readln(k,n); for i:=k to n do if simply(i) then begin if (i=2) or (i=3) or (i=5) or (i=7) or cr(i) then begin write(i,' '); co:=1; end end; if co=0 then write(0); end.
const n=10;
var a:array[1..n] of integer;
i,min,s:integer;
begin
for i:=1 to n do
begin
a[i]:=random(81)+10;
write(a[i]:4);
end;
writeln;
min:=a[1];
for i:=1 to n do
begin
if a[i]<min then min:=a[i];
s:=s+a[i];
end;
writeln('min = ',min);
writeln('s = ',s);
end.
Пример:
54 58 67 78 58 79 54 78 44 60
min = 44
s = 630
2)
const n=9; m=6;
var a:array[1..n,1..m] of integer;
i,j:integer;
begin
for i:=1 to n do
for j:=1 to m do a[i,j]:=i;
for i:=1 to n do
begin
for j:=1 to m do write(a[i,j]);
writeln;
end;
end.
Результат:
111111
222222
333333
444444
555555
666666
777777
888888
999999
var k,n,i: longint;
co: byte;
function simply(a: longint ):boolean;
var i: longint;
begin
simply:=true;
for i:=2 to trunc(sqrt(a)) do begin if a mod i=0 then begin
simply:=false;
break
end
end
end;
function cr(a: longint): boolean;
var n: longint;
begin
n:=a;
cr:=false;
repeat
n:=n div 10;
until n mod 10 =n;
if n=(a mod 10) then
begin
cr:=true;
end;
end;
begin
readln(k,n);
for i:=k to n do if simply(i) then begin if (i=2) or (i=3) or (i=5) or (i=7) or cr(i) then
begin
write(i,' ');
co:=1;
end
end;
if co=0 then write(0);
end.