function fun(m){
if (m <= 2) return 1
return fun(m-1) + fun(m-2)
}
while(m>0) {
let num = fun(m)
console.log(num)
m--
} 1 看一看 666
1111
111 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>兔子生小兔子</title>
</head>
<script>
var month = prompt("打算这对小兔子繁殖多少个月呀?(例: 12):");
var rub = Array();
for(i=0;i<=month-1;i++){
if(i>=3){
rub.push(rub+rub);
document.write(rub+" ");
}
else{
rub.push(1);
}
}
</script>
<body>
</body>
</html> 对个答案
1 ...
页:
1
[2]