Write a menu driven program using JavaScript to find square root, power and absolute value of a given number.
Answers
Answer:
JavaScript to find square root, power and absolute value of a given number.
Explanation:
From the above question,
Square Root of a Number :
const number = prompt('Enter the number: ');
const result = Math.sqrt(number);
console.log(`The square root of ${number} is ${result}`);
const number1 = 2.25;
const number2 = -4;
const number3 = 'hello';
const result1 = Math.sqrt(number1);
const result2 = Math.sqrt(number2);
const result3 = Math.sqrt(number3);
console.log(`The square root of ${number1} is ${result1}`);
console.log(`The square root of ${number2} is ${result2}`);
console.log(`The square root of ${number3} is ${result3}`);
Find absolute value of a given number:
using System;
using System.Collections.Generic;
class GFG{
// Function to find the absolute value
static void findAbsolute(int N)
{
if (N < 0)
{
N = (-1) * N;
}
Console.Write("{0} ", N);
}
public static void Main(String[] args)
{
int N = -12;
findAbsolute(N);
}
}
For more related question : https://brainly.in/question/28467835
#SPJ1