initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user