close
<html>
<script language="javascript">
<!--
function f( v )
{
//if ( v == 0 || v == 1 )
if ( v < 2 ) {
return v;
} else {
return f( v - 1 ) + f( v - 2 );
}
}
var n = window.prompt("請輸入數字:(遞迴 0 ~ n 項)","");
for (var i = 0; i <= n; i++)
{
document.write( f( i ) + " ");
}
//-->
</script>
</html>
全站熱搜
留言列表