当前位置:网站首页>Output all composite numbers between 6 and 1000
Output all composite numbers between 6 and 1000
2022-07-07 08:53:00 【Please Sit Down】
subject : Write a program to output in 6~1000 All the sums of , Composite refers to 1 The number equal to the sum of its factors . for example ,6=1+2+3,28=1+2+4+7+14, be 6、28 It's a total number .
int main(void)
{
int i, k, sum;
printf("6~1000 All composite numbers between :\n");
for (i = 6; i <= 1000; i++) // The range of the number judged by the outer loop control is 6-1000
{
sum = 0;
for (k = 1; k < i; k++) // The inner loop finds the sum of the factors of a number
if (i % k == 0)
sum += k;
if (i == sum) // Number of judgements i Whether it is the sum of its factors sum equal , If equal , Is a composite number
printf("%d\t", i);
}
return 0;
} ![]()
边栏推荐
- About using CDN based on Kangle and EP panel
- Greenplum6.x常用语句
- Frequently Asked Coding Problems
- What are the advantages of commas in conditional statements- What is the advantage of commas in a conditional statement?
- let const
- 最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼
- The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
- Greenplum 6.x build_ install
- 说一个软件创业项目,有谁愿意投资的吗?
- 如何在HarmonyOS应用中集成App Linking服务
猜你喜欢

Greenplum 6.x build_ install
![[Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology](/img/2a/01db1b84c26502c851786aaca56abe.jpg)
[Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology
![Data analysis methodology and previous experience summary 2 [notes dry goods]](/img/e1/643e847a777e1effcbd39f8b009e2b.png)
Data analysis methodology and previous experience summary 2 [notes dry goods]

关于基于kangle和EP面板使用CDN

Introduction to data fragmentation

leetcode135. Distribute candy

Category of IP address

Recommended by Alibaba P8, the test coverage tool - Jacobo is very practical

Mountaineering team (DFS)

LeetCode 736. Lisp 语法解析
随机推荐
[wechat applet: cache operation]
You should use Google related products with caution
AVL balanced binary search tree
关于基于kangle和EP面板使用CDN
Oracle makes it clear at one time that a field with multiple separators will be split into multiple rows, and then multiple rows and columns. Multiple separators will be split into multiple rows, and
为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
Selenium automation integration, eight years of testing experience, soft test engineer, an article to teach you
Greenplum6.x-版本变化记录-常用手册
Markdown编辑器Editor.md插件的使用
数据库存储---表分区
Mountaineering team (DFS)
All about PDF crack, a complete solution to meet all your PDF needs
Novice entry SCM must understand those things
Download and install orcale database11.2.0.4
数据分析方法论与前人经验总结2【笔记干货】
Leetcode 1984. Minimum difference in student scores
MySQL主从延迟的解决方案
Newly found yii2 excel processing plug-in
注解@ConfigurationProperties的三种使用场景
What is the method of manual wiring in PCB design in 22protel DXP_ Chengdu electromechanical Development Undertaking