JAVASCRIPT TO FIND GREATEST AMONG 3 NUMBERS




JAVASCRIPT TO FIND GREATEST AMONG 3 NUMBERS




<html>
<head>
<h1>Greatest Among Three Numbers</h1>
</head>
<body>
<script type="text/javascript">
var a=10,b=20,c=7;
/* checks a>b and a>c  if  both conditions satisfied, A is greater */
if (a>b  && a>c)
{
document.write("<b>A is greater</b>");
}
/* checks b>a  and b>c  if  both conditions satisfied, b is greater */
if (b>a  && b>c)
{
document.write("<b>B is greater</b>");
}
/* if the above two conditions were false c is greater*/
else
{
document.write("<b>C is greater</b>");
}
</script>
</body>
</html>
Post A Comment
  • Blogger Comment using Blogger
  • Facebook Comment using Facebook
  • Disqus Comment using Disqus

No comments :

Thanks For visiting Infotech Solutuion Blog