Page

Find the greatest value in java script

<html>
<head>
<script>

function greatest()
{
a = prompt("enter a","");
b = prompt("enter b","");
c = prompt("enter c","");

if(a>b)
{
if(a>c)
{
document.write(a + " is greatest");
}
else
{
document.write(c + " is greatest");
}
}
else
{
if(b>c)
{
document.write(b + " is greatest");
}
else
{
document.write(c + " is greatest");
}
}
}
</script>
</head>
<body>
<button onclick="greatest()">Try it</button>
</body>
</html>

No comments:

Post a Comment