//HTML
DECIMAL TO BINARY CONVERSION
Entered the number in binary
Binary to Decimal converted
/*Binary to Decimal converter*/
.contanier-6
{
width:90%;
height: 190vh;
padding-left:4% ;
padding-right: 4%;
box-sizing: border-box;
/* background-color:rgb(160, 186, 192); */
margin-left: 90px;
position: relative;
bottom: 380px;
}
.row-6-1
{
display: flex;
flex-wrap: wrap;
flex-direction: column;
margin-top: 100px;
margin-left: 50px;
height: 70vh;
background-color:rgb(135, 228, 208);
border: 20px solid rgb(2, 103, 110);
border-radius: 20px;
}
.contanier-6 h1
{
position: relative;
left: 170px;
top: 70px;
z-index: -1;
}
.form
{
padding-left: 200px;
padding-top: 70px;
}
.form input
{
margin-top: 20px;
padding: 0.6rem 15vh;
border-radius: 20px;
border: 2px solid rgb(135, 228, 208);
}
.form h2
{
margin-top: 20px;
}
#btn
{
margin-top: 50px;
margin-bottom: 30px;
border-radius: 20px;
background-color: #e28b00;
color: white;
font-size: 18px;
}
#btn:hover
{
background-color: #493ac8;
color: rgb(255, 255, 255);
font-size: 20px;
padding-left: 17vh;
cursor: pointer;
}
.chupa-rustum
{
display: none;
}
.row-6-2 h1
{
font-size: 30px;
margin-bottom: 30px;
}
const binary=()=>{
let binary = document.getElementById('binary').value;
let rem;
let n=0;
let cal=0;
// Calcualtions
while (binary != 0) {
rem = binary % 10;
cal=cal+(rem*(Math.pow(2,n)));
//Use the parseInt to conver the division in the in t form
binary=parseInt(binary/10);
n++;
}
// Display
document.getElementById('decimal').value=cal;
}
If you don't find any problem,in this website and if you have a very difficult assignment question that is not present on internet ,then you dont bother yourself,we are here to solve every problem of your life you just click on the Problem asking button and write your problem we slove the code of your problem and sent you on your email addres that you put in the sin up form.