How to Create Arccos calculator Using JavaScript With HTML?

Hello Friends Today, through this tutorial, I will tell you How to Write Program Arccos calculator using JavaScript with HTML.Sure, here’s a simple example of an Arccos calculator using JavaScript with HTML:


<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arccos Calculator</title>
body {
font-family: Arial, sans-serif;
text-align: center;
#result {
margin-top: 20px;
font-weight: bold;
<h2>Arccos Calculator</h2>
<label for="angle">Enter the angle (in degrees):</label>
<input type="number" id="angle" placeholder="Angle in degrees" step="any">
<button onclick="calculate()">Calculate</button>
<div id="result"></div>
function calculate() {
var angleInput = document.getElementById('angle').value;
var angle = parseFloat(angleInput);
if (!isNaN(angle)) {
if (angle >= -1 && angle <= 1) {
var arccos = Math.acos(angle);
var arccosDegrees = arccos * (180 / Math.PI);
document.getElementById('result').innerText = "Arccos(" + angle + ") = " + arccosDegrees.toFixed(2) + " degrees";
} else {
document.getElementById('result').innerText = "Angle must be between -1 and 1 for arccos calculation.";
} else {
document.getElementById('result').innerText = "Please enter a valid number.";

This code creates a simple HTML page with an input field for entering an angle in degrees. When you click the “Calculate” button, it computes the arccosine of the entered angle (in radians) using the `Math.acos()` function and converts the result back to degrees. Finally, it displays the result on the page.


Arccos Calculator