1) program zadacha1; uses crt; var b,i,j:integer; c,pr:real; a:array [1..4,1..7] of integer;
begin clrscr; pr:=1; for i:=1 to 4 do begin for j:=1 to 7 do begin readln(a[i,j]); end; end; for i:=1 to 4 do begin for j:=1 to 7 do begin if (a[i,j] mod 3) = 0 then pr:=pr*a[i,j]; end; end; pr:=pr/3; writeln(pr:2:3); readkey; end.
2) program zadacha2; uses crt; const k=8; var b,i,j,sum:integer; c,pr:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; pr:=1; for i:=1 to k do begin for j:=1 to k do begin a[i,j]:=random(36)+10; end; end;
for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end; for j:=1 to k do begin if (a[k,j] mod 5) = 0 then pr:=pr*a[i,j]; end;
for i:=1 to k do begin for j:=1 to k do begin if (i=j) and (a[i,j] > 0) then sum:=sum+a[i,j]; end; end;
3) program zadacha3; uses crt; const k=9; var b,i,j:integer; sred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do begin a[i,j]:=random(55-12+1)+12; end; end; for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end;
for i:=1 to k do begin if (a[i,k] mod 2) = 1 then begin l:=l+a[i,k]; b:=b+1; end; end; sred:=l/b;
for i:=1 to k do begin if a[i,i]>25 then sum:=sum+a[i,i]; end; writeln;
4) program zadacha4; uses crt; const k=5; var b,i,j:integer; sred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do begin a[i,j]:=random(91)-20; end; end; j:=k; for i:=1 to k do begin if (a[i,j] mod 2)<> 0 then begin l:=l+a[i,j]; b:=b+1; end; j:=j-1; end; sred:=l/b;
for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end; writeln;
writeln('Srednee ',sred:4:2); readkey; end.
5) program zadacha5; uses crt; const k=5; var b,i,j:integer; sred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do begin a[i,j]:=random(31)-40; end; end; j:=k; for i:=1 to k do begin if (a[i,j] mod 2)<> 0 then begin l:=l+a[i,j]; b:=b+1; end; j:=j-1; end; sred:=l/b;
for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end; writeln;
writeln('Srednee ',sred:4:2); readkey; end.
6)
program zadacha6; uses crt; const k=6; var b,i,j:integer; sred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do begin a[i,j]:=random(21); end; end; j:=k; for i:=1 to k do begin if a[i,j]>5 then begin l:=l+a[i,j]; end; j:=j-1; end; l:=l/2;
for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end; writeln;
writeln('Sum ',l:2:2); readkey; end.
7)
program zadacha7; uses crt; const k=5; var b,i,j:integer; pred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do a[i,j]:=random(10); end; j:=k; for i:=1 to k do begin l:=l+a[i,j]; j:=j-1; end;
for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end;
for i:=1 to k do begin sum:=sum+a[i,i]; end; pred:=sum+l;
writeln('Sum ',pred/10:2:2); readkey; end.
8) program zadacha8; uses crt; const k=5; var b,i,j:integer; pred,sum,l:real; a:array [1..k,1..k] of integer;
begin randomize; clrscr; for i:=1 to k do begin for j:=1 to k do a[i,j]:=random(10); end; j:=k; for i:=1 to k do begin l:=l+a[i,j]; j:=j-1; end; l:=l/k; for i:=1 to k do begin for j:=1 to k do write(a[i,j],' '); writeln; end;
for i:=1 to k do begin sum:=sum+a[i,i]; end; sum:=sum/2;
1)
program zadacha1;
uses crt;
var b,i,j:integer;
c,pr:real;
a:array [1..4,1..7] of integer;
begin
clrscr;
pr:=1;
for i:=1 to 4 do
begin
for j:=1 to 7 do
begin
readln(a[i,j]);
end;
end;
for i:=1 to 4 do
begin
for j:=1 to 7 do
begin
if (a[i,j] mod 3) = 0 then pr:=pr*a[i,j];
end;
end;
pr:=pr/3;
writeln(pr:2:3);
readkey;
end.
2)
program zadacha2;
uses crt;
const k=8;
var b,i,j,sum:integer;
c,pr:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
pr:=1;
for i:=1 to k do
begin
for j:=1 to k do
begin
a[i,j]:=random(36)+10;
end;
end;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
for j:=1 to k do
begin
if (a[k,j] mod 5) = 0 then pr:=pr*a[i,j];
end;
for i:=1 to k do
begin
for j:=1 to k do
begin
if (i=j) and (a[i,j] > 0) then sum:=sum+a[i,j];
end;
end;
writeln('Prozvedenie ',pr:2:2);
writeln('Summa ',sum);
writeln('Raznostb ',pr-sum:2:2);
readkey;
end.
3)
program zadacha3;
uses crt;
const k=9;
var b,i,j:integer;
sred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
begin
a[i,j]:=random(55-12+1)+12;
end;
end;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
for i:=1 to k do
begin
if (a[i,k] mod 2) = 1 then
begin
l:=l+a[i,k];
b:=b+1;
end;
end;
sred:=l/b;
for i:=1 to k do
begin
if a[i,i]>25 then sum:=sum+a[i,i];
end;
writeln;
writeln('Srednee ',sred:2:2);
writeln('Summa ',sum:2:1);
readkey;
end.
4)
program zadacha4;
uses crt;
const k=5;
var b,i,j:integer;
sred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
begin
a[i,j]:=random(91)-20;
end;
end;
j:=k;
for i:=1 to k do
begin
if (a[i,j] mod 2)<> 0 then
begin
l:=l+a[i,j];
b:=b+1;
end;
j:=j-1;
end;
sred:=l/b;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
writeln;
writeln('Srednee ',sred:4:2);
readkey;
end.
5)
program zadacha5;
uses crt;
const k=5;
var b,i,j:integer;
sred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
begin
a[i,j]:=random(31)-40;
end;
end;
j:=k;
for i:=1 to k do
begin
if (a[i,j] mod 2)<> 0 then
begin
l:=l+a[i,j];
b:=b+1;
end;
j:=j-1;
end;
sred:=l/b;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
writeln;
writeln('Srednee ',sred:4:2);
readkey;
end.
6)
program zadacha6;
uses crt;
const k=6;
var b,i,j:integer;
sred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
begin
a[i,j]:=random(21);
end;
end;
j:=k;
for i:=1 to k do
begin
if a[i,j]>5 then
begin
l:=l+a[i,j];
end;
j:=j-1;
end;
l:=l/2;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
writeln;
writeln('Sum ',l:2:2);
readkey;
end.
7)
program zadacha7;
uses crt;
const k=5;
var b,i,j:integer;
pred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
a[i,j]:=random(10);
end;
j:=k;
for i:=1 to k do
begin
l:=l+a[i,j];
j:=j-1;
end;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
for i:=1 to k do
begin
sum:=sum+a[i,i];
end;
pred:=sum+l;
writeln('Sum ',pred/10:2:2);
readkey;
end.
8)
program zadacha8;
uses crt;
const k=5;
var b,i,j:integer;
pred,sum,l:real;
a:array [1..k,1..k] of integer;
begin
randomize;
clrscr;
for i:=1 to k do
begin
for j:=1 to k do
a[i,j]:=random(10);
end;
j:=k;
for i:=1 to k do
begin
l:=l+a[i,j];
j:=j-1;
end;
l:=l/k;
for i:=1 to k do
begin
for j:=1 to k do
write(a[i,j],' ');
writeln;
end;
for i:=1 to k do
begin
sum:=sum+a[i,i];
end;
sum:=sum/2;
writeln('Sum ',sum:2:2);
writeln('Sred',l:2:2);
readkey;
end.
var
s: string;
i, count: integer;
begin
writeln('Vvedite stroky: ');
readln(s);
for i := 1 to length(s) - 2 do
if copy(s, i, 3) = 'abc' then
count := count + 1;
writeln('Kol-vo: ', count);
end.
2.
var
s1, s2: string;
i, len1, len2: integer;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
len1 := length(s1);
len2 := length(s2);
if len1 > len2 then writeln('1 stroka dlinnee')
else if len1 < len2 then writeln('2 stroka dlinnee')
else writeln('dlini strok ravnie')
end.
3.
var
s1, s2, s3: string;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
s3 := s1[1] + s1[2] + s2[1] + s2[2];
writeln('Novaja stroka: ', s3);
end.