当前位置:网站首页>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;
} ![]()
边栏推荐
- Markdown编辑器Editor.md插件的使用
- [Chongqing Guangdong education] organic electronics (Bilingual) reference materials of Nanjing University of Posts and Telecommunications
- How to integrate app linking services in harmonyos applications
- 数字三角形模型 AcWing 275. 传纸条
- Greenplum6.x重新初始化
- Shell script for changing the current folder and the file date under the folder
- Quick sorting (detailed illustration of single way, double way, three way)
- Greenplum 6.x build_ install
- Three usage scenarios of annotation @configurationproperties
- Appeler l'interface du moteur de création du service multimédia de jeu Huawei renvoie le Code d'erreur 1002, le message d'erreur: les paramètres sont l'erreur
猜你喜欢

调用华为游戏多媒体服务的创建引擎接口返回错误码1002,错误信息:the params is error

Digital triangle model acwing 1027 Grid access

Quick sorting (detailed illustration of single way, double way, three way)

如何在HarmonyOS应用中集成App Linking服务

Three series of BOM elements

Greenplum 6.x version change record common manual
![[step on the pit] Nacos registration has been connected to localhost:8848, no available server](/img/ee/ab4d62745929acec2f5ba57155b3fa.png)
[step on the pit] Nacos registration has been connected to localhost:8848, no available server

Greenplum 6.x monitoring software setup

leetcode134. gas station

23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
随机推荐
Category of IP address
测试踩坑 - 当已有接口(或数据库表中)新增字段时,都需要注意哪些测试点?
LeetCode 715. Range module
Uniapp wechat applet monitoring network
对API接口或H5接口做签名认证
路由信息协议——RIP
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月6日-新手快速上手-可无缝升级tp6版本
Frequently Asked Coding Problems
Gson converts the entity class to JSON times declare multiple JSON fields named
The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
QT charts use (rewrite qchartview to realize some custom functions)
Redis fault handling "can't save in background: fork: cannot allocate memory“
JS operation
With an annual salary of 50W, Alibaba P8 will come out in person to teach you how to advance from testing
[step on the pit] Nacos registration has been connected to localhost:8848, no available server
Interpolation lookup (two methods)
ncs成都新電面試經驗
【微信小程序:缓存操作】
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
快速集成认证服务-HarmonyOS平台