Created
March 15, 2022 10:59
-
-
Save wakoliVotes/bd54843f031c2eb3200547627b3724d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript"> | |
// Use parseInt to convert the entered string to integer | |
var x = parseInt(prompt("Enter First Number: ")); | |
var y = parseInt(prompt("Enter Second Number: ")); | |
var sum = x + y; | |
var prod = x * y; | |
function sumNumbers () { | |
alert(`The Sum of ${x} and ${y} is ${sum}`); | |
} | |
function multiNumbers(){ | |
alert(`The Product of ${x} and ${y} is ${prod}`); | |
} | |
function checkLarge(){ | |
if (x > y){ | |
alert(`${x} is Greater Than ${y}`) | |
} | |
else if (x == y){ | |
alert(`x = ${x} and y= ${y} are Equal`); | |
} else { | |
alert(`${x} is Less Than ${y}`); | |
} | |
} | |
</script> | |
<title>Document</title> | |
</head> | |
<body style="text-align: center;"> | |
<h3>Welcome to JavaScript</h3> | |
<p>We Are <strong>Adding</strong> Two Numbers Here</p> | |
<form action=""> | |
<input type="button" value="Sum Numbers" onclick="sumNumbers()" /> | |
<!-- onClick is an event --> | |
</form> | |
<!-- Multiplication --> | |
<p>We Are <strong>Multiplying</strong> Two Numbers Here</p> | |
<form action=""> | |
<input type="button" value="Product Numbers" onclick="multiNumbers()" /> | |
<!-- onClick is an event --> | |
</form> | |
<!-- Displaying largest --> | |
<p>We Are <strong>Showing Control Structures</strong> for Two Numbers</p> | |
<form action=""> | |
<input type="button" value="Check Larger Number" onclick="checkLarge()" /> | |
<!-- onClick is an event --> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment