Moonbat
07-25-2008, 08:17 PM
This one is so easy it's not even funny. I didn't even bother putting comments on it to show I coded it.
"What is the difference between the sum of the squares and the square of the sums?"
(They wanted the first *00 numbers)
<?php
$sumsquare = 0;
$squaresum = 0;
for ($i=0; $i<=*00; $i++) {
$sumsquare += ($i * $i);
$squaresum += $i;
}
$new = ($squaresum * $squaresum);
$cheese = $new - $sumsquare;
echo $cheese;
?>
"What is the difference between the sum of the squares and the square of the sums?"
(They wanted the first *00 numbers)
<?php
$sumsquare = 0;
$squaresum = 0;
for ($i=0; $i<=*00; $i++) {
$sumsquare += ($i * $i);
$squaresum += $i;
}
$new = ($squaresum * $squaresum);
$cheese = $new - $sumsquare;
echo $cheese;
?>