You are given a square matrix A [N, N]. Write in the place of negative elements of the matrix zeros
March 17, 2021 | education
| You are given a square matrix A [N, N]. Write in the place of negative elements of the matrix zeros, and in place of positive ones – ones.
program zz1;
const n = 3;
// set the number of elements in the array
var i, j, k: integer; // set variables of integer type
b: array [1..n, 1..n] of integer;
begin
for i: = 1 to n do
for j: = 1 to n do // get numbers and write them into an array
b [i, j]: = random (101) -50;
for i: = 1 to n do // display the original array on the screen
begin
for j: = 1 to n do
write (b [i, j]: 4);
writeln;
end;
writeln;
for i: = 1 to n do
for j: = 1 to n do
if b [i, j] <0 then b [i, j]: = 0 else b [i, j]: = 1;
for i: = 1 to n do // display the resulting array on the screen
begin
for j: = 1 to n do
write (b [i, j]: 4);
writeln;
end;
end.
One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.