PHP is a server scripting language, and It is a powerful tool for making interactive and dynamic Web-pages. I have used WampServer 2.2 for following excercise..
<?php
$primes = array();
$is_prime_no = false;
for ($i = 2; $i<200; $i++) {
$is_prime_no = true;
for ($j = 2; $j<=($i/2); $j++) {
if ($i%$j==0) {
$is_prime_no = false;
break;
}
}
if ($is_prime_no) {
array_push($primes,$i);
}
if (count($primes)==200) {
break;
}
}
echo array_sum($primes)."\n";
?>
PHP is a server scripting language, and It is a powerful tool for making interactive and dynamic Web-pages. I have used WampServer 2.2 for following excercise..
Result:
4227
need an explanation for this answer? contact us directly to get an explanation for this answer