RosettaCodeData/Task/Multiplication-tables/PowerShell/multiplication-tables-1.ps1

22 lines
393 B
PowerShell
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
# For clarity
$Tab = "`t"
# Create top row
$Tab + ( 1..12 -join $Tab )
# For each row
ForEach ( $i in 1..12 )
{
$( # The number in the left column
$i
# An empty slot for the bottom triangle
@( "" ) * ( $i - 1 )
# Calculate the top triangle
$i..12 | ForEach { $i * $_ }
# Combine them all together
) -join $Tab
}