珠峰海拔8848米,现在有足够大的纸,厚度是0.01米,折多少次高度可以超过珠穆朗玛峰。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
function show(a){ //定义一个函数
for(var i=1; ;i++){ //定义当前次数为1次
a*=2; //a为折纸厚度,每次折叠等于a*2,依此叠加直到超过8848停止循环
if(a>8848){ //如果a大于8848时停止循环
break;
}
}
document.write(i);//输出次数
}
show(0.01); //调用定义的函数show输出
</script>
</head>
<body>
</body>
</html>