Last active
April 9, 2016 08:15
-
-
Save primats/2eadd05613cde3dbdd949259ebef7791 to your computer and use it in GitHub Desktop.
Числа Фибоначчи
This file contains 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
<!DOCTYPE HTML> | |
<html> | |
<title>Числа Фибоначчи</title> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
function fib(n){ | |
if (n==1||n==2) return 1; | |
else return fib(n-2)+fib(n-1); | |
} | |
var userNum=+prompt('Введите порядковый номер числа Фибоначчи'); | |
alert(fib(userNum)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment