Write JavaScript program To find highest from given three values
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Practical-12</title>
</head>
<body>
<Script>
//Write JavaScript to perform the following operations: a)to find highest from given three values
var num1 = prompt("Enter first Number");
var num2 = prompt("Enter Second Number");
var num3 = prompt("Enter third number");
var largest;
if (num1 > num2 && num1 > num3) {
largest = num1;
} else if (num2 > num1 && num2 > num3) {
largest = num2;
} else if (num3 > num1 && num3 > num2) {
largest = num3;
}
alert(largest + " is a highest number");
</Script>
</body>
</html>
Output:
Comments
Post a Comment