Wednesday, December 8, 2010

Javascript program to find factorial of given number

Hello everybody I want to discuss the javascript code for find factorial of given number


HTML CODE




<html>
<head>
<title>
Javascript program for find factorial of given number
</title>
<script type="text/javascript">
function fact(n)
{
var m=1;
while(n)
{
m=m*n;
n--;
}
alert("Factorial of given number :"+" "+ m);
}
</script>
</head>
<body>
<h1 align="center"><font color="green">Javascript Program for calculate factorial</font></h1>
<form name="frm1">
Enter any number :<input type="text" name="fact1"><br><br>
<input type="submit" value="calculate factorial" onclick="fact(frm1.fact1.value)">
</form>
</body>
</html>

OUTPUT




10 comments:

Aniket said...

N1

Princess...... said...

good wrk

ගීතික බුලත්සිංහල said...

thanks

amit said...

thanks :)
gr8 help buddy

mca guys said...

i want n series of fatorial num program.plz help............

Unknown said...

good one

Unknown said...

nice

Unknown said...

bt this language is very typical

Unknown said...

excellent work

Unknown said...

guys i need a program using factorial of 7 in javascript with the help of promptbox

Post a Comment

Dont SPAM