Answers for "find max of three numbers in javascript"

1

find max of three numbers in javascript

//find max of two values/ find max of Three values
let business = 30000;
let job = 10000;
let entrepreneur = 90000;
function whoisrich(){
    if (business<job && entrepreneur<job) {
        return "Job is best"
    }
    else if (job<business && entrepreneur<business) {
        return "Do business cause it is bigger"
    }
    else{
        return "Be an entrepreneur it is the biggest";
    }
}
console.log(whoisrich(entrepreneur))
Posted by: Guest on August-07-2021
0

find the largest number in else if javascript

// 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);
Posted by: Guest on November-29-2020

Code answers related to "find max of three numbers in javascript"

Browse Popular Code Answers by Language