Situatie
In this example, you’ll learn to write a program to find the square root of a number in JavaScript.
Solutie
Pasi de urmat
// take the input from the user
const number = prompt(‘Enter the number: ‘);
const result = Math.sqrt(number);
console.log(`The square root of ${number} is ${result}`);
Output
Enter the number: 9
The square root of 9 is 3
Leave A Comment?