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

25 lines
321 B
PowerShell

$num = gc 8.txt
function product() {
BEGIN {
[int]$prod = 1
}
PROCESS {
#write-host 'prod ' $prod
$prod *= [int][string]$_
#write-host $_ $prod
}
END {
$prod
}
}
$max = 0
for ($i=0; $i -lt $num.length - 5; $i++) {
$curr = $num[$($i)..$($i+4)] | product
if ($curr -gt $max) {
$max = $curr
}
}
$max