Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Identity-matrix/Yabasic/identity-matrix.basic
Normal file
24
Task/Identity-matrix/Yabasic/identity-matrix.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue