• 6 вариант. Даны две квадратные матрицы А и В размером 3х3. Требуется найти С= В – А.
    Дана вещественная матрица А(N.M). Составить программу замены всех отрицательных элементов матрицы на элемент, имеющий максимальное значение.

Ответы 1

  • 1)var a:array[1..3,1..3] of integer;b:array[1..3,1..3] of integer;c:array[1..3,1..3] of integer;i,j:integer;begin;writeln('A array:');for i:=1 to 3 dobegin;writeln;  for j:=1 to 3 do   begin;    a[i,j]:=random(-10,10);    write(a[i,j]:4);   end;end;writeln;writeln('B array:');for i:=1 to 3 dobegin;writeln;  for j:=1 to 3 do   begin;    b[i,j]:=random(-10,10);    write(b[i,j]:4);   end;end;writeln;writeln('C array:');for i:=1 to 3 dobegin;writeln;  for j:=1 to 3 do   begin;    c[i,j]:=b[i,j]-a[i,j];    write(c[i,j]:4);   end;end;end.2)var a:array of array of real;i,j,n,m:integer;max:real;begin;randomize;max:=-2147483648;readln(n);readln(m);setlength(a,n+1);for i:=1 to n dosetlength(a[i],m+1);writeln('A array:');for i:=1 to n do begin;  writeln;   for j:=1 to m do    begin;    a[i,j]:=random(-10,10);    if max<a[i,j] then max:=a[i,j];    write(a[i,j]:4);    end; end;for i:=1 to n do for j:=1 to m do  if a[i,j]<0 then a[i,j]:=max;writeln;writeln('Final array:');for i:=1 to n do begin;  writeln;   for j:=1 to m do    write(a[i,j]:4); end;end.  
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years