Home  >  Article  >  Web Front-end  >  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

青灯夜游
青灯夜游Original
2022-01-28 11:29:171957browse

方法: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++)
  • 在循环中,判断该数是否能被13整除,如果不能被整除,则输出

if(i%13!=0)

完整实现代码:

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

输出代码:

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!

Statement:
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
Previous article:Is ecmascript a language?Next article:Is ecmascript a language?