Project Euler Problem 18
by michiganfootball20
JavaScript
<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$input = file("input.txt");
for($i = count($input)-1; $i >= 0; $i--)
{
$number_array[] = explode(" ", $input[$i]);
}
for($i = 1; $i < count($number_array); $i++)
{
for($j = 0; $j < count($number_array[$i]); $j++)
{
$number_array[$i][$j] += max($number_array[$i-1][$j], $number_array[$i-1][$j+1]);
echo $number_array[$i][$j] . ' ';
}
echo '<br>';
}
?>
</body>
</html>