All Rounder Tools Blogger-Best blog for blogger: Decimal to Octal converter Tool with colorful styling and all its features use any free library

Sunday, September 29, 2024

Decimal to Octal converter Tool with colorful styling and all its features use any free library

 

Decimal to Octal Converter

Decimal to Octal Converter

Octal Value:

body { font-family: Arial, sans-serif; background-color: #f0f8ff; color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); text-align: center; } h1 { color: #4a90e2; } input[type="number"] { padding: 10px; margin: 10px 0; border: 2px solid #4a90e2; border-radius: 5px; width: 100%; box-sizing: border-box; transition: border-color 0.3s; } input[type="number"]:focus { border-color: #007bff; outline: none; } button { background-color: #4a90e2; color: white; padding: 10px 15px; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #007bff; } h2 { margin-top: 20px; color: #d35400; } document.getElementById('convertButton').addEventListener('click', function() { const decimalInput = document.getElementById('decimalInput').value; const octalOutput = document.getElementById('octalOutput'); if (decimalInput === "") { octalOutput.textContent = "Please enter a valid decimal number."; return; } const decimalNumber = parseInt(decimalInput, 10); if (isNaN(decimalNumber) || decimalNumber < 0) { octalOutput.textContent = "Please enter a non-negative integer."; return; } const octalNumber = decimalNumber.toString(8); octalOutput.textContent = octalNumber; });

No comments:

Post a Comment