esercizi js

This commit is contained in:
2014-11-30 18:46:24 +01:00
parent b2e9b46742
commit c30036a3bc
11 changed files with 597 additions and 27 deletions

31
js_3.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
function f (n) {
var base = n-1;
if (n > 1)
return n * base * f( n - 2);
else
return 1;
}
value = prompt("Inserire numero tra 1 e 15");
if ( value && !isNaN(value) && value>=1 && value<=15 )
document.writeln(f(value));
else
alert("Error");
</script>
</body>
</html>