You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
248 B
PHTML
14 lines
248 B
PHTML
9 years ago
|
<?php
|
||
|
/*
|
||
|
* Gnieark's anwser to euler problem 6
|
||
|
* https://projecteuler.net/problem=6
|
||
|
*/
|
||
|
$sumOfTheSquares=0;
|
||
|
for($i=1;$i<101;$i++){
|
||
|
$sumOfTheSquares+=pow($i,2);
|
||
|
}
|
||
|
$sum=0;
|
||
|
for($i=1;$i<101;$i++){
|
||
|
$sum+=$i;
|
||
|
}
|
||
|
echo pow($sum,2) - $sumOfTheSquares;
|