Computer Science, asked by lakshmichaitanyachal, 1 day ago

write a program to input a number and find and display large digit of number in javascript​

Answers

Answered by itzmecutejennei
1

Answer:

program to find the largest among three numbers

// take input from the user

const num1 = parseFloat(prompt("Enter first number: "));

const num2 = parseFloat(prompt("Enter second number: "));

const num3 = parseFloat(prompt("Enter third number: "));

let largest;

// check the condition

if(num1 >= num2 && num1 >= num3) {

largest = num1;}

else if (num2 >= num1 && num2 >= num3) {

largest = num2;}

else {largest = num3;}

// display the result

console.log("The largest number is " + largest);

Output

Enter first number: -7

Enter second number: -5

Enter third number: -1

The largest number is -1

Similar questions