Kmspico Download | Official KMS Activator Website [New Version 2024] Fast and Easy Converter YouTube to MP3 Online KMSAuto Net Activator Download 2024 Immediate Byte Pro Blacksprut without borders. Discover new shopping opportunities here where each link is an entrance to a world ruled by anonymity and freedom.

Cosine Calculator Using JavaScript with HTML Example

Hello Friends Today, through this tutorial, I will tell you How to Write Program Cosine calculator using JavaScript with HTML. Sure, here’s a simple example of a cosine 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>Cosine Calculator</title>
<h2>Cosine Calculator</h2>
<p>Enter an angle in degrees:</p>
<input type="number" id="angleInput" placeholder="Angle in degrees">
<button onclick="calculateCosine()">Calculate</button>
<p id="result"></p>

function calculateCosine() {

// Get the input value
var angleDegrees = document.getElementById("angleInput").value;

// Convert degrees to radians
var angleRadians = angleDegrees * Math.PI / 180;

// Calculate the cosine
var cosineValue = Math.cos(angleRadians);

// Display the result
document.getElementById("result").innerHTML = "Cosine of " + angleDegrees + " degrees is " + cosineValue.toFixed(4);

This code creates a simple webpage with an input field for the angle in degrees and a button to calculate the cosine of that angle. When the button is clicked, it triggers the `calculateCosine()` function, which retrieves the input value, converts it to radians, calculates the cosine using `Math.cos()`, and then displays the result on the page.


Cosine Calculator

Enter an angle in degrees: