Const n = 3; k = 3; var i,j,s1,s2:integer; a:array[1..n,1..k] of integer; begin s1:=0; s2:=0; for i:=1 to n do for j:=1 to k do begin Writeln('Введите a[',i,',',j,']:'); readln(a[i,j]); if (a[i,j]>0) and (i<>j) then s1:=s1+a[i,j]; if (a[i,j]<0) and (i<>j) then s2:=s2+a[i,j]; end; if s1>s2 then for j:=1 to k do begin a[1,j]:=s1; a[n,j]:=s1; end; if s2>=s1 then for i:=1 to n do begin a[i,1]:=s2; a[i,k]:=s2; end; writeln('Полученный массив:'); for i:=1 to n do begin for j:=1 to k do write('a[':4,i,',',j,']=',a[i,j]); writeln; end; end.
Ольга1520
27.11.2020
#include <iostream.h> #include <math.h> int main() { int a, b, c; long long d; cout << "Vvedite a: "; cin >> a; cout << "\nVvedite b: "; cin >> b; cout << "\nVvedite c: "; cin >> c; d = b * b - 4 *a * c; if (d > 0) cout << "x1 = " << (-b + sqrt(d))/(2*a) << "\n" << "x2 = " << (-b - sqrt(d))/(2*a) << endl; else if (d == 0) cout << "x = " << -1.*b/(2*a) << endl; else if (d < 0) cout << "Korney net" << endl; system("pause"); return 0; }
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Как называется услуга по размещению оборудования клиента на территории провайдера?
n = 3;
k = 3;
var
i,j,s1,s2:integer;
a:array[1..n,1..k] of integer;
begin
s1:=0;
s2:=0;
for i:=1 to n do
for j:=1 to k do
begin
Writeln('Введите a[',i,',',j,']:');
readln(a[i,j]);
if (a[i,j]>0) and (i<>j) then s1:=s1+a[i,j];
if (a[i,j]<0) and (i<>j) then s2:=s2+a[i,j];
end;
if s1>s2 then
for j:=1 to k do
begin
a[1,j]:=s1;
a[n,j]:=s1;
end;
if s2>=s1 then
for i:=1 to n do
begin
a[i,1]:=s2;
a[i,k]:=s2;
end;
writeln('Полученный массив:');
for i:=1 to n do
begin
for j:=1 to k do
write('a[':4,i,',',j,']=',a[i,j]);
writeln;
end;
end.