0
Using javascript find greatest number among four number?number is given using if else
2 Answers
+ 3
document.write(Math.max(a, b, c, d))
+ 1
<html>
<head>
<script>
var a=5;
var b=10;
var c=17;
var d=13;
if(a>b)
{
if(a>c)
{
if(a>d)
document.write(a);
else
document.write(d);
}
else
{
if(c>d)
document.write(c);
else
document.write(d);
}
}
else
{
if(b>c)
{
if(b>d)
document.write(b);
else
document.write(d);
}
else
{
if(c>d)
document.write(c);
else
document.write(d);
}
}
</script>
</head>
<body>
</body>
</html>