CODE:-
<html>
<head>
<title>Factorial</title>
<style type="text/css">
body{
background-color:lightgreen;
}
.tab{
background-color:yellow;
color:;
text-transform:capitalize;
}
.v1{
text-align:center;
background-color:lightblue;
}
.v2{
text-align:center;
background-color:blue;
color:white;
}
</style>
<script type="text/javascript">
function check()
{
var a=document.f1.no.value;
var i,fact=1;
for(i=1;i<=a;i++)
{
fact=fact*i;
}
document.f1.ans.value=fact;
return false;
}
</script>
</head>
<body>
<center>
<form name="f1" method="post" onsubmit="return check()">
<table border="1" cellspacing="0" class="tab">
<tr class="v2">
<th colspan="2">factorial of given number</th>
</tr>
<tr>
<th>enter number:</th>
<td><input type="text" name="no" size="5" style="border-radius:10px;"></td>
</tr>
<tr class="v1">
<td colspan="2">
<input type="submit" name="submit" value="Submit" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
<input type="reset" name="reset" value="Reset" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
</td>
</tr>
<tr>
<th>factorial is:</th>
<td><input type="text" name="ans" size="5" style="border-radius:10px;"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
No comments:
Post a Comment