当前位置:网站首页>Print out all prime numbers between 1-100
Print out all prime numbers between 1-100
2022-07-29 05:47:00 【Just learning records】
Print out 1-100 All prime numbers between
1、 find 1-100 All the numbers between
2、 Judge whether it is prime
3、 Print out the prime number found
<script type="text/javascript">
/**
* 2、 Print out 1-100 All prime numbers between
* ( Prime number : except 1 And outside of himself , Numbers that cannot be divided by other numbers are called prime numbers )
* We know 1 It's neither prime nor sum , So the following code directly from 2 Start
*/
// Print 2-100 All the numbers between
for(var i=2;i<=100;i++){
var flag=true;
// Judge i Is it a prime number , obtain 2-i All the numbers between
for(var j=2;j<i;j++){
// Judge i If I can be j to be divisible by
if(i%j == 0){
// If you enter the judgment, it will prove i Not prime , modify flag The value of is false
flag=false;
}
}
if(flag){
document.write(i+" ");
}
}
</script>
边栏推荐
- 大部分PHP程序员,都搞不懂如何安全代码部署
- Windows下cmd窗口连接mysql并操作表
- DAY4:MySQL 数据库的建立及简单实用
- Plato Farm有望通过Elephant Swap,进一步向外拓展生态
- Thinkphp6管道模式Pipeline使用
- Liang Yuqi, founder of aitalk: the link between image and virtual reality
- 超简单集成HMS ML Kit 实现parental control
- The LAAS protocol of defi 2.0 is the key to revitalizing the development of defi track
- 深度学习的趣味app简单优化(适合新手)
- [C language series] - constants and variables that confuse students
猜你喜欢

July 28 ens/usd Value Forecast: ENS attracts huge profits

Shanzhai coin Shib has a US $548.6 million stake in eth whale's portfolio - traders should be on guard

闪贷Dapp的调研及实现

HCIA-R&S自用笔记(25)NAT技术背景、NAT类型及配置

Qtcreator+cmake compiler settings

【电子电路】ADC芯片如何选型

量化开发必掌握的30个知识点【什么是分笔逐笔数据】?
![[electronic circuit] how to select ADC chip](/img/41/05153704986117ce9adaa09cb71a7a.png)
[electronic circuit] how to select ADC chip

Move protocol global health declaration, carry out the health campaign to the end

Starfish OS: create a new paradigm of the meta universe with reality as the link
随机推荐
The LAAS protocol of defi 2.0 is the key to revitalizing the development of defi track
改哭了,终于解决了Cannot read properties of undefined (reading ‘parseComponent‘)
极致通缩和永动机模型,将推动 PlatoFarm 爆发
Qframe class learning notes
Win10 compiles ffmpeg (including ffplay)
What is sqlmap and how to use it
熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
7 月 28 日 ENS/USD 价值预测:ENS 吸引巨额利润
[electronic circuit] how to select ADC chip
Basic concepts of MySQL + database system structure + extended application + basic command learning
Crypto giants all in metauniverse, and platofarm may break through
使用Qss设置窗体样式
Cmu15-213 shell lab experiment record
第五空间智能安全⼤赛真题----------PNG图⽚转换器
闪贷Dapp的调研及实现
The difference between link and @import importing external styles
马斯克推崇的柏拉图式元宇宙,PlatoFarm早已验证出答案
Set the background color of a cell in the table
华为2020校招笔试编程题 看这篇就够了(下)
DAO赛道异军突起,M-DAO的优势在哪里?