Search This Blog

Thursday, 6 September 2012

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


Filename-s5.html

<html>
<head>
<script language="javascript">
var no1=Math.random()*100;
var no2=Math.random()*100;
document.write("no1="+no1+"<br>");
document.write("no2="+no2+"<br>");

if(no1 > no2)
{
ducument.write("max no="+no1);
}
else
{
document.write("max no"+no2);
}
</script>
</head>
<body>
</body>
</html>

Output
no1=87.61335089802742
no2=77.67163217067719

No comments:

Post a Comment