Files
2025-08-03 20:16:55 -07:00

28 lines
421 B
PowerShell

function IsPalendrome([string] $str)
{
for ($i = 0; $i -lt $str.Length/2; $i++)
{
if ($str[$i] -ne $str[$str.Length - 1 - $i])
{
return $FALSE;
}
}
return $TRUE;
}
$greatest = [int]::minvalue
for ($j = 999; $j -gt 99; $j--)
{
for ($k = $j; $k -lt 1000; $k++)
{
$mul = $j * $k
if (IsPalendrome $mul)
{
if ($mul -gt $greatest)
{
$greatest = $mul
write-host "$j * $k = $mul"
}
}
}
}