S
Sean
I have been given a task of having a user enter 3 numbers then
displaying them in ascending order using nested if...else statements
as part of my course. I beleive I am close but am having issues with
the last two if statement not running.
Can someone please tell me if I am going about this in the right way?
Have I got all the possibilities that three numbers can appear
correct?
If you can tell me what I am doing wrong and point me in the right
direction that would be appreciated.
Regards
Sean
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Enter Title Here</title>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
<!-- hide from incompatible browsers
var num1, num2, num3;
num1 = prompt("Please enter the first number", "");
num2 = prompt("Please enter the second number", "");
num3 = prompt("Please enter the third number", "");
if (num1 < num2)
if (num2 < num3)
document.write("possibilty one: " + num1 + num2 + num3);
else
{
if (num1 < num2)
if (num2 > num3)
document.write("possibilty two: " + num1 + num3 +
num2);
else
{
if (num1 < num2)
if (num2 < num3)
document.write("possibilty three: " + num1 +
num2 + num3);
else //1
{
if (num1 < num2)
if (num2 > num3)
document.write("possibilty four: " +
num1 + num2 + num3);
else
{
}
}
}
}
// Stop hiding from incompatible browsers -->
</script>
</head>
<body>
</body>
</html>
displaying them in ascending order using nested if...else statements
as part of my course. I beleive I am close but am having issues with
the last two if statement not running.
Can someone please tell me if I am going about this in the right way?
Have I got all the possibilities that three numbers can appear
correct?
If you can tell me what I am doing wrong and point me in the right
direction that would be appreciated.
Regards
Sean
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Enter Title Here</title>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
<!-- hide from incompatible browsers
var num1, num2, num3;
num1 = prompt("Please enter the first number", "");
num2 = prompt("Please enter the second number", "");
num3 = prompt("Please enter the third number", "");
if (num1 < num2)
if (num2 < num3)
document.write("possibilty one: " + num1 + num2 + num3);
else
{
if (num1 < num2)
if (num2 > num3)
document.write("possibilty two: " + num1 + num3 +
num2);
else
{
if (num1 < num2)
if (num2 < num3)
document.write("possibilty three: " + num1 +
num2 + num3);
else //1
{
if (num1 < num2)
if (num2 > num3)
document.write("possibilty four: " +
num1 + num2 + num3);
else
{
}
}
}
}
// Stop hiding from incompatible browsers -->
</script>
</head>
<body>
</body>
</html>