Source Code Menentukan Sebuah Bilangan Prima atau Bukan

Published 06/12/2012 by onpumooirahayu

Under_Construction_Computer

  • Syntax HTML

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;

<html>

 

<head>

<title>:: Bilangan Prima ::</title>

<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ />

<meta name=”generator” content=”HAPedit 3.1″>

</head>

<body bgcolor=”#B0E0E6″>

<form action=”” method=”post”>

<tr>

<td size =10>.::SOAL NO1::.</td> <br>

</tr>

<tr>

<td size=5> ~Buatlah Program PHP Untuk Menentukan Apakah Sebuah Bilangan Termasuk Bilangan Prima atau Bukan~</td><br>

</tr>

<tr>

<td size=5><hr width=”100%” align=”left” color=”#800080″></td><br> <br> <br>

</tr>

<table width=”100%” border=”0″ cellspacing=”0″ cellpadding =”0″>

<tr>

<td width=”15%”> ~Masukan Bilangan~</td>

<td width=”2%”>:</td>

<td width=”83%”><input type =”text” name =”tes”/></td>

</tr>

<tr>

<td colspan =”3″><input type =”submit” value=”:: Hitung Bilangan ::” name=”tombol” /></td>

</tr>

</form>

 

<?php

if($_POST [‘tes’].=””)

{

$a=$_POST [‘tes’];

$d=”$a Adalah Bilangan Prima”;

for($c=2; $c<=$a-1; $c++)

{

if (($a % $c)== 0)

{

$d =”$a Bukan Bilangna Prima”;

break;

}

}

echo $d;

}

?>

echo “<hr />\n”.

“HAPedit 3.1.11.111 (Oktober 2012 2:07:22)”;

</body>

</html>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: