este es un pequeño script en Php que transforma de Decimal A binario , usa una caja de texto que es donde el usuario insertara el numero y al presionar el boton muestra el resultado ...
este es el Codido :
<?php
print "<center><h1>Decimal 2 binary</h1>";print "<form action='index.php'><input type='text' size='40' name='dec' value=''><input type='submit' value='make it!' name='make'>";
$n=$_GET['dec'];
$t=0;
$c=0;
if($n==NULL)print "<br>debes escribir un numero <br>";
while($n>0)
{
$t=$n%2;
$arr[$c]=$t;
$n=$n/2;
$c++;
}
print "<table border='1' bgcolor='green'><tr><td><h3>";
for($i=0;$i<1082;$i++)
if($i>1065)print $arr[$c-$i];
print "</h3></tr></table></center>";
?>
enjoy the code ....
No hay comentarios:
Publicar un comentario