Last active
March 28, 2018 16:42
-
-
Save Mortimer333/cfee3bd68ef8d0a2e8bf3f7386f2f5b5 to your computer and use it in GitHub Desktop.
Factorial in Js (html)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title> | |
JS page | |
</title> | |
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8"> | |
<meta http-equiv= "Content-Language" content="pl"> | |
<script type="text/javascript"> | |
function factorial(n) | |
{ | |
var factorial=1; | |
for(i=1; i<=n; i++) | |
{ | |
factorial=factorial*i; | |
} | |
return factorial; | |
} | |
</script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
n=prompt("Pick up a number.",""); | |
eval(n); | |
document.write(n+" factorial is "+factorial(n)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment