Saturday, 25 January 2014

java script program for factorial of a given number using for loop

<html>
<head>
<title>
Factorial Program
</title>
</head>
<body bgcolor=chocolate>
<h1 align=center>
Factorial Program with For Loop
</h1>
<script language=javascript>
var fact=1
document.writeln("<font color=navy size=6>")
for(var i=1;i<=10;i++)
{
fact=fact*i;
document.writeln(i+" ! = "+fact+"<br>")
}
</script>
</body>
</html>

No comments:

Post a Comment