RosettaCodeData/Task/Identity-matrix/Phix/identity-matrix.phix

14 lines
232 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
function identity(integer n)
sequence res = repeat(repeat(0,n),n)
for i=1 to n do
res[i][i] = 1
end for
return res
end function
ppOpt({pp_Nest,1})
pp(identity(3))
pp(identity(5))
pp(identity(7))
pp(identity(9))