PHP Compiler
<!DOCTYPE html> <html> <body> <?php $start = 1; $end = 20; $count = 0; $flag = 0; $i = 1; echo "Prime numbers between $start and $end: <br>"; for($start=$start; $start<=$end; $start++) { for($i=1; $i<=$start; $i++) { if($start % $i == 0) $count++; } if($count == 2) { $flag = 1; echo "$start "; } $count = 0; } if($flag == 0) echo "There is no Prime numbers between the given series"; ?> </body> </html>
OUTPUT
Prime numbers between 1 and 20:
2 3 5 7 11 13 17 19
×

Save as Private