Last active
August 29, 2015 14:06
-
-
Save guitarrapc/b722303a4752f54bb9e3 to your computer and use it in GitHub Desktop.
True play for http://blogs.technet.com/b/heyscriptingguy/archive/2014/09/22/fun-formatting-ones-part-1-the-task.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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