postheadericon 5. Write a JavaScript to generate two random numbers and find out maximum and minimum out of it.




<html>
<head>
<title>EX-5: WTAD : www.bipinrupadiya.com</title>

<script type="text/javascript">
function bsr()
{
var rnd1=Math.floor(Math.random()*100);
var rnd2=Math.floor(Math.random()*100);
document.write('<br>Random No.1 : ' + rnd1);
document.write('<br>Random No.2 : ' + rnd2);
if (rnd1 < rnd2)
{
document.write('<br><br>Minimum No.:' + rnd1);
document.write('<br>Maximum No.:' + rnd2);
}
else
{
document.write('<br><br>Minimum No.:' + rnd2);
document.write('<br>Maximum No.:' + rnd1);
}
}
</script>

</head>

<body onLoad='bsr();'>

</body>
</html>

0 comments:

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.