Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Code for finding Prime Numbers

<?php
              
              $no = 2;
              $total_display = 0;
              while ($total_display < 100 ) {
                $divisible_count = 0;
                for($i = 1; $i <=$no; $i++) {
                    if($no % $i == 0) {
                      $divisible_count += 1;
                    }
                }
                if($divisible_count < 3) {
                  echo $no . " ";
                  $total_display += 1;
                }
                $no += 1;
              }
?>
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Code #finding #Prime #Numbers
ADD COMMENT
Topic
Name
6+5 =