26 lines
446 B
Plaintext
26 lines
446 B
Plaintext
arraybase 1
|
|
do
|
|
input "Enter size of matrix: ", n
|
|
until n > 0
|
|
|
|
dim identity(n, n) fill 0 #we fill everything with 0
|
|
|
|
# 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
|