JS——do...while循环输出斐波拉契数前20项
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
document.write("第一题:输出前20项斐波拉契数:");
var a=1,b=1,c;
var i=1;
do{
c=a+b;
a=b;
b=c;
document.write(""+c+"--");
i++;
}
while(i<=20);
</script>
</body>
</html>