标签:console ack col rip div charset bsp title 循环
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> </body> </html> <script> // 假设m某人有100000现金,每经过一次路口需要进行一次缴费,交费规则为当他现金大于50000时每次需要交5% 如果现金小于等于50000时每次交5000.可以经过多少次这个路口 var m = 100000; var n = 1; while(m>=5000){ n++; if(m>=50000){ m = m*0.95; }else if(m<50000){ m = m -5000; } console.log("每次剩余"+m+"钱时,"+"这个时候是第"+n+"次过路口"); } console.log("一共可以过"+n+"次路口"); </script>
标签:console ack col rip div charset bsp title 循环
原文地址:https://www.cnblogs.com/lsqbk/p/10258998.html