Hello! How can I fill the matrix at random so that the numbers are both positive and negative? Positive know that like this.

randomize; for i:=1 to n do for j:=1 to n do matr[i,j]:=random(10); write(matr[i,j]:5) writeln; 

What needs to be changed?

    1 answer 1

    Negatives can be obtained from positive uncomplicated arithmetic operations. For example, I need numbers from -10 to 10. We get a random number from 0 to 20 and subtract 10. That's all.