RosettaCodeData/Task/Identity-matrix/NetRexx/identity-matrix-1.netrexx
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

19 lines
623 B
Text

/* NetRexx ************************************************************
* show identity matrix of size n
* I consider m[i,j] to represent the matrix
* 09.07.2013 Walter Pachl (translated from REXX Version 2)
**********************************************************************/
options replace format comments java crossref symbols binary
Parse Arg n .
If n='' then n=5
Say 'Identity Matrix of size' n '(m[i,j] IS the Matrix)'
m=int[n,n] -- Allocate 2D square array at run-time
Loop i=0 To n-1 -- Like Java, arrays in NetRexx start at 0
ol=''
Loop j=0 To n-1
m[i,j]=(i=j)
ol=ol m[i,j]
End
Say ol
End