25 lines
427 B
Plaintext
25 lines
427 B
Plaintext
repeat
|
|
input "Enter size of matrix: " n
|
|
until n > 0
|
|
|
|
dim identity(n, n) // all zero by default
|
|
|
|
// enter 1s in diagonal elements
|
|
for i = 1 to n
|
|
identity(i, i) = 1
|
|
next i
|
|
|
|
// print identity matrix if n < 40
|
|
print
|
|
|
|
if n < 40 then
|
|
for i = 1 to n
|
|
for j = 1 to n
|
|
print identity(i, j);
|
|
next j
|
|
print
|
|
next i
|
|
else
|
|
print "Matrix is too big to display on 80 column console"
|
|
end if
|