RosettaCodeData/Task/Identity-matrix/PowerShell/identity-matrix-1.ps1

7 lines
163 B
PowerShell
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
function identity($n) {
0..($n-1) | foreach{$row = @(0) * $n; $row[$_] = 1; ,$row}
}
function show($a) { $a | foreach{ "$_"} }
$array = identity 4
show $array