当前位置:网站首页>JS-Bom-while(计算闰年)
JS-Bom-while(计算闰年)
2022-08-08 14:24:00 【(-^_^-)】
计算是否是闰年:
非整百年:能被4整除的为闰年。
整百年:能被400整除的是闰年。
function hanshu(){
var n1 =document.getElementById('1');
var n2 =document.getElementById('2');
var n=0;
year=parseInt(n1.value);
while(n<10){//计算10次
if((year%4==0&&year%400!=0)||year%400==0)
{
//非整百年:能被4整除的为闰年。
//整百年:能被400整除的是闰年。
n++;
n2.innerHTML+=year+",";
}
year++;
}
}
边栏推荐
- LeetCode简单题之统计星号
- KMP Media Group South Africa implemented a DMS (Document Management System) to digitize the process, employees can again focus on their actual tasks, providing efficiency
- shell------常用小工具,sort,uniq,tr,cut
- Verilog语法基础HDL Bits训练 09
- 全网最全的AItium Designer 16下载资源与安装步骤
- 全网最全的PADS 9.5安装教程与资源包
- sample function—R language
- OrderedDict构建函数模块的不常见写法
- 基于QWebassembly的一个数据库监测工具
- 线程的状态简介说明
猜你喜欢
Verilog HDL Bits training 09 grammar foundation
sample function—R language
译文推荐|深入解析 BookKeeper 协议模型与验证
电商秒杀系统架构设计
Verilog语法基础HDL Bits训练 09
Talking about the underlying data structure of Redis
华为云云数据库RDS MySQL 版初试探【华为云至简致远】
shell------常用小工具,sort,uniq,tr,cut
直播卖货APP——为何能得到商家和用户的喜欢?
【Rust—LeetCode题解】1408.数组中的字符串匹配
随机推荐
开源一夏 | 自己画一块ESP32-C3 的开发板(PCB到手)
华为云会议初体验【华为云至简致远】
synchronized修饰类的注意事项
[Small Coder Study Room] [NOI Online 2020-2 Beginner Group] Finished: Abominable precision will make you burnt
shell------常用小工具,sort,uniq,tr,cut
itk中图像2d-3d配准整理
【小码匠自习室】朋友的朋友不是朋友
非科班毕业生,五面阿里:四轮技术面+HR一面已拿offer
直播卖货APP——为何能得到商家和用户的喜欢?
【系统设计】S3 对象存储
"Small yards artisan study room" friends of friends is not a friend
[Redis] Bitmap and usage scenarios of bitmap (statistics of online people and user online status)
机器学习+深度学习笔记(持续更新~)
PC端实用软件推荐
彻底了解什么是POE交换机!!!
基于接口而非实现编程
PHP —— 用 ThinkPHP5.0 实现微信小程序登陆
小白大白读论文-关于EfficientNetV2论文的 疑问 与 总结
【小码匠自习室】叛逆的小孩,打死也不改
华为云会议的优势【华为云至简致远】