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;
Program p1; var a,b:integer; begin writeln ('Введите 2 числа'); readln (a,b); if a=b then writeln ('Числа одинаковые') else if a>b then begin writeln ('Наибольшее число ',a); writeln ('Наименьшее число ',b); end else begin writeln ('Наибольшее число ',b); writeln ('Наиментшее число 10 ',a); end; end.
program p2; var a,b,c,d:integer; begin writeln ('Введите 4 числа'); readln (a,b,c,d); if a<b then a:=b; if c<d then c:=d; if a<c then a:=c; writeln ('Наибольшее число ',a); end.
program p3; var a,b,v:integer; begin writeln ('Введите возрасты людей:'); write ('Антона - '); readln (a); write ('Бориса - '); readln (b); write ('Виктора - '); readln (v); if (a=b) and (a=v) then writeln ('Все люди одного возраста'); if (a=b) and (a>v) then writeln ('Антон и Борис старше Виктора'); if (a=b) and (a<v) then writeln ('Виктор старше всех') else if (v>a) and (v>b) then writeln ('Виктор старше всех'); if (b=v) and (b>a) then writeln ('Борис и Виктор старше Антона'); if (b=v) and (b<a) then writeln ('Антон старше всех') else if (a>v) and (a>b) then writeln ('Антон старше всех'); if (a=v) and (a>b) then writeln ('Антон и Виктор старше Бориса'); if (a=v) and (a<b) then writeln ('Борис старше всех') else if (b>v) and (b>a) then writeln ('Борис старше всех'); end.
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Задан массив x(n получить массив y(n) из элементов x(n) в обратном порядке
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.