JavaScript Program to Convert Decimal Number to Binary Equivalent

Write a JavaScript program to convert Decimal number to Binary equivalent.



Source Code
<html>
<head>
    <title>Convert Decimal number to Binary number</title>
</head>
<body>
<script>
    var decimal = parseInt(prompt("Enter the decimal number", ""));
    var binary = decimal.toString(2);
    document.write("Binary equivalent of " + decimal + " is : " + binary)
</script>
</body>
</html>
Output





"Coding Hub - Learn to code" app now available on Google Play Store