21. Finding the Maximum of Two
Numbers
JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Maximum
Number</title>
</head>
<body>
<script>
var num1 = 10;
var num2 = 5;
var maxNum = Math.max(num1, num2);
document.write("The maximum number is:
" + maxNum);
</script>
</body>
</html>
This finds the maximum value between
num1 and num2.
No comments:
Post a Comment