Revision: 65588
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 26, 2013 22:45 by Sadeveloper
Initial Code
<?php /** * Softafzar.Net | Developers home_ * http://softafzar.net */ $num1 = 2; $num2 = 200; $col = 0; echo "<h1>List of prime numbers from $num1 to $num2 </h1>"; echo '<table width="60%" border="1"><tr>'; foreach ( Prime ( $num1, $num2 ) as $item ) { if ($col >= 10) { echo '</tr><tr>'; $col = 0; } echo "<td> $item </td>"; $col ++; } echo '</tr></table>'; function Prime($num1, $num2) { $prime_numbers = array (); while ( $num1 < $num2 ) { $isprime=true; for($i = 2; $i <= sqrt ( $num1 ); $i ++) { if ($num1 % $i == 0) $isprime=false; } if ( $isprime ) { $prime_numbers [] = $num1; } $num1 ++; } return $prime_numbers; } ?>
Initial URL
http://www.softafzar.net/thread1575.html/
Initial Description
List of prime numbers between two number
Initial Title
List of prime numbers between two number
Initial Tags
php
Initial Language
PHP