Home > Web Front-end > Front-end Q&A > How to use javascript to find the number from 0 to 200 that is not divisible by 13

How to use javascript to find the number from 0 to 200 that is not divisible by 13

青灯夜游
Release: 2022-01-28 11:30:38
Original
2012 people have browsed it

方法:1、用“for (var i=0;i

How to use javascript to find the number from 0 to 200 that is not divisible by 13

本教程操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。

利用javascript求0到200中不能被13整除的数

实现思想:

  • 使用for循环语句遍历0到200的数

for(var i=0;i<=200;i++)
Copy after login
  • 在循环中,判断该数是否能被13整除,如果不能被整除,则输出

if(i%13!=0)
Copy after login

完整实现代码:

for(var i=0;i<=200;i++){
	if(i%13!=0){
		console.log(i);
	}
}
Copy after login

输出代码:

How to use javascript to find the number from 0 to 200 that is not divisible by 13

How to use javascript to find the number from 0 to 200 that is not divisible by 13

How to use javascript to find the number from 0 to 200 that is not divisible by 13

How to use javascript to find the number from 0 to 200 that is not divisible by 13

How to use javascript to find the number from 0 to 200 that is not divisible by 13

【相关推荐:javascript学习教程

The above is the detailed content of How to use javascript to find the number from 0 to 200 that is not divisible by 13. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template