Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Ejercicio </title>
- </head>
- <body>
- <script type="text/javascript">
- function binario(n) {
- var array = [];
- while (n <= 1) {
- div = n / 2;
- rest = n % 2;
- array.push(rest);
- n = div;
- bi = array.join("");
- }
- alert(bi);
- }
- binario(8);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement