当前位置:网站首页>JS uses the while cycle to calculate how many years it will take to grow from 1000 yuan to 5000 yuan if the interest rate for many years of investment is 5%
JS uses the while cycle to calculate how many years it will take to grow from 1000 yuan to 5000 yuan if the interest rate for many years of investment is 5%
2022-06-27 07:35:00 【I am the sun?】
The code is as follows :
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title> If the interest rate for many years of investment is 5%, Try to follow 1000 The block grows to 5000 block , How many years will it take </title>
<script type="text/javascript">
var money = 1000;
var year = 0;
while(money <= 5000){
money = money +(money*0.05);
year++;
console.log(" The first " + year + " year , Yes " + money + " element "+"<br />");
}
</script>
</head>
<body>
</body>
</html>
The operation results are as follows :
Or it could be :
Code :
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title> If the interest rate for many years of investment is 5%, Try to follow 1000 The block grows to 5000 block , How many years will it take </title>
<script type="text/javascript">
var money = 1000;
var year = 0;
while(money <= 5000){
money = money +(money*0.05);
year++;
}
console.log(" The first " + year + " year , Yes " + money + " element "+"<br />");
</script>
</head>
<body>
</body>
</html>
Running results :
边栏推荐
- Bean copy details
- VNC Viewer方式的远程连接树莓派
- Websocket database listening
- Rust中的Pin详解
- 高薪程序员&面试题精讲系列116之Redis缓存如何实现?怎么发现热key?缓存时可能存在哪些问题?
- Idea method template
- Speech synthesis: tacotron explains [end-to-end speech synthesis model] [compared with traditional speech synthesis, it does not have complex phonetics and acoustic feature modules, but only uses < te
- boundvalueops和opsforvalue区别
- js打印99乘法表
- 程序人生 - 程序员三十五岁瓶颈你怎么看?
猜你喜欢
随机推荐
R language analyzing wine data
guava 定时任务
JDBC事务提交事例
PostgreSQL encounters permission denied in Windows system
Yolov6's fast and accurate target detection framework is open source
Speech signal processing - concept (I): time spectrum (horizontal axis: time; vertical axis: amplitude), spectrum (horizontal axis: frequency; vertical axis: amplitude) -- Fourier transform -- > time
Oppo interview sorting, real eight part essay, abusing the interviewer
高薪程序员&面试题精讲系列116之Redis缓存如何实现?怎么发现热key?缓存时可能存在哪些问题?
程序人生 - 程序员三十五岁瓶颈你怎么看?
使用 Blackbox Exporter 测试网络连通性
1-4 decimal representation and conversion
R 语言 基于关联规则与聚类分析的消费行为统计
MySQL
R language calculates Spearman correlation coefficient in parallel to speed up the construction of co occurrence network
js用while循环计算假如投资多年的利率为5%,试求从1000块增长到5000块,需要花费多少年
RNA SEQ data analysis in R - investigate differentially expressed genes in the data!
js例题打印1-100之间所有7的倍数的个数及总和
Window right click management
Use uview to enable tabbar to display the corresponding number of tabbars according to permissions
Cookie加密6








