<body>
<script>
/**
* 1.序列:1,2,3,5,8,13...。找出第20个数是多少?
* 得出前20个数之和是多少?
*/
let i, j, k, n,sum=3;
//k=i+j
i = 1; j = 2;
for (n = 3; n <= 20; n++) {
k = i + j;
sum=sum+k;
i = j; j = k;
document.write('第'+n+'个数是'+k+'\t')
}
document.write(sum);
</script>
</body>