Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Last active August 29, 2015 14:06
Show Gist options
  • Save guitarrapc/b722303a4752f54bb9e3 to your computer and use it in GitHub Desktop.
Save guitarrapc/b722303a4752f54bb9e3 to your computer and use it in GitHub Desktop.
1..8 | % {$n="1" * $_; Write-Host ("{0,9} x {0,9} = " -f $n) -n;$x=("$n * $n" | iex); $x | %{$n=$_;$l=$_ -split "";[int]$z=($l.length-1)/2;$l | where {$_} | %{$i=1}{if($l.length -2 -eq 1){Write-Host $_ -Fo Red}elseif($i -eq $l.length - 2){Write-Host $_}elseif($i -eq $z){Write-Host $_ -n -Fo Red}elseif($i -lt $z){Write-Host $_ -n}elseif($i -gt $z){Write-Host $_ -n};$i++}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment