Shreenil.com Spirituality javascript program to find the square root

javascript program to find the square root

// prompt user for a number
let num = prompt(“Enter a number: “);

// calculate the square root
let sqrt = Math.sqrt(num);

// display the result
console.log(`The square root of ${num} is ${sqrt}.`);
In this program, we first prompt the user to enter a number using the prompt() function. We then use the Math.sqrt() function to calculate the square root of the number. Finally, we use console.log() to display the result to the user.


There is no ads to display, Please add some

Related Post