Информатика. Выполнить действия с числами в двоичной системе счисления. Выполнить проверку в десятичной системе счисления. 1) (1011101-10110)+100= 2) 10110+1101+101= 3)111111-11+11=
В одном месте, видимо, опечатка (№ 21-25 два раза, а № 26-30 нет). const n=40; var x:array[1..100] of real; i:integer; begin Randomize; for i:=1 to 5 do begin write('x[',i,']='); readln(x[i]); end; for i:=6 to 10 do x[i]:=random(11); for i:=11 to 15 do x[i]:=random(11)-10; for i:=16 to 20 do x[i]:=random(31)+20; for i:=21 to 25 do x[i]:=random(31)-50; for i:=31 to 40 do x[i]:=i*i; for i:=30 downto 26 do x[i]:=x[i+1]+x[i+2]; for i:=1 to n do write(x[i],' '); writeln; end.
Var ar:array[1..n,1..m] of integer; i,j:integer; begin randomize; writeln('First matrix:'); for i:=1 to n do begin for j:=1 to m do begin ar[i,j]:=random(100); write(ar[i,j]:4); if ar[i,j] mod 3=2 then inc(ar[i,j]); end; writeln; end; writeln('Final matrix:'); for i:=1 to n do begin for j:=1 to m do write(ar[i,j]:4); writeln; end; end.
const n=40;
var x:array[1..100] of real;
i:integer;
begin
Randomize;
for i:=1 to 5 do begin
write('x[',i,']=');
readln(x[i]);
end;
for i:=6 to 10 do x[i]:=random(11);
for i:=11 to 15 do x[i]:=random(11)-10;
for i:=16 to 20 do x[i]:=random(31)+20;
for i:=21 to 25 do x[i]:=random(31)-50;
for i:=31 to 40 do x[i]:=i*i;
for i:=30 downto 26 do x[i]:=x[i+1]+x[i+2];
for i:=1 to n do write(x[i],' ');
writeln;
end.
Пример:
x[1]=32
x[2]=49
x[3]=81
x[4]=27
x[5]=50
32 49 81 27 50 3 7 7 6 5 -9 -4 -3 -3 0 23 32 40 24 36 -43 -26 -34 -44 -22 12808 7877 4931 2946 1985 961 1024 1089 1156 1225 1296 1369 1444 1521 1600
Const
n=4;
m=4;
Var
ar:array[1..n,1..m] of integer;
i,j:integer;
begin
randomize;
writeln('First matrix:');
for i:=1 to n do
begin
for j:=1 to m do
begin
ar[i,j]:=random(100);
write(ar[i,j]:4);
if ar[i,j] mod 3=2 then inc(ar[i,j]);
end;
writeln;
end;
writeln('Final matrix:');
for i:=1 to n do
begin
for j:=1 to m do
write(ar[i,j]:4);
writeln;
end;
end.
Пример вывода:
First matrix:
20 80 1 69
25 77 97 3
32 56 97 23
99 81 12 82
Final matrix:
21 81 1 69
25 78 97 3
33 57 97 24
99 81 12 82