Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<form method='POST' action='cetak.php'>";
- echo "masukkan bilangan awal : <input type='text' name= 'awal'>";
- echo "<input type=submit value='cetak bilangan prima'></form>";
- if($_SERVER['REQUEST_METHOD']=='POST'){
- $jum=0;
- $awal=$_POST['awal'];
- $a=0;
- if($jum<=10){
- while($i>=$awal){
- $j=0;
- while($j>$i)
- if($i%$j==0){
- $a++;
- }
- if($a==2){
- echo $i.'<br>';
- $jum=count($i); //bingung ambil nilai 1cetakan $i dihitung = 1
- //soalnya count kan buat ngitung hasil dr nilai $i dtambahkan trs
- }
- $i++;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment