利率
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>投资的年利率</title>
<script type="text/javascript">
var money = 1000;
var count = 0;
while(money < 5000){
money *= 1.05;
count++;
}
console.log("一共需要" + count + "年");
</script>
</head>
<body>
</body>
</html>
成绩
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>成绩</title>
<script type="text/javascript">
while(true){
var score = prompt("请输入小明的期末成绩(0-100):");
if(score <= 100 && score >= 0){
break;
}
alert('请输入有效的分数!!!');
}
if(score == 100){
alert("宝马");
}else if(score >= 80){
alert("手机");
}else if(score >= 60){
alert("参考书");
}else{
alert("");
}
</script>
</head>
<body>
</body>
</html>
网友评论