<html> <body> <script type="text/javascript"> a=prompt("Enter Number1: "); b=prompt("Enter Number2: "); c=prompt("Enter Number3: "); d=prompt("Enter Number4: "); a=parseInt(a); b=parseInt(b); c=parseInt(c); d=parseInt(d); if (a>b && a>c && a>d) { document.write(+a+"<b> Is Greatest Number</b><br/>"); } else if (a>b && a>c || a>c && a>d || a>b && a>d) { document.write(+a+"<b> Is at Second Mid</b><br/>"); } else if (a>b || a>c || a>d) { document.write(+a+"<b>Is at First Mid </b><br/>"); } else { document.write(+a+"<b>Is Least Number</b><br/>"); } if (b>a && b>c && b>d) { document.write(+b+"<b> Is Greatest Number</b><br/>"); } else if (b>a && b>c || b>c && b>d || b>d && b>d) { document.write(+b+"<b>Is at Second Mid Position</b><br/>"); } else if (b>a || b>c || b>d) { document.write(+b+"<b>Is at First Mid Position</b><br/>"); } else { document.write(+b+"</b>Is Least Number</b><br/>"); } if (c>a && c>b && c>d) { document.write(+c+"<b>Is Greatest Number</b> <br/>"); } else if (c>a && c>b || c>b && c>d || c>a && c>d) { document.write(+c+"<b>Is at Second Mid Position</b><br/>"); } else if (c>a || c>b || c>d) { document.write(+c+"<b>Is at First Mid Position</b><br/>"); } else { document.write(+c+"<b>Is Least Number </b><br/>"); } if (d>a && d>c && d>b) { document.write(+d+"<b>Is Greatest Number</b> <br/>"); } else if (d>a && d>b || d>b && d>c || d>a && d>c) { document.write(+d+"<b>Is at Second Mid Position</b><br/>"); } else if (d>a || d>b || d>c) { document.write(+d+"<b>Is at First Mid Position</b><br/>"); } else { document.write(+d+"<b>Is Least Number</b><br/>"); } </script> </body> </html>
Easy Programming Code ,free download software with keys,c++ toturial,c++ codes and much more....
Monday, September 10, 2012
Comparing four number in javascript.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment