当前位置:网站首页>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;
} ![]()
边栏推荐
- Test pits - what test points should be paid attention to when adding fields to existing interfaces (or database tables)?
- 阿里p8手把手教你,自动化测试应该如何实现多线程?赶紧码住
- FPGA knowledge accumulation [6]
- Esp32-ulp coprocessor low power mode RTC GPIO interrupt wake up
- Interpolation lookup (two methods)
- Lenovo hybrid cloud Lenovo xcloud: 4 major product lines +it service portal
- 年薪50w阿裏P8親自下場,教你如何從測試進階
- MySQL主从延迟的解决方案
- Greenplum6.x搭建_环境配置
- Quick sorting (detailed illustration of single way, double way, three way)
猜你喜欢

PPT模板、素材下载网站(纯干货,建议收藏)

最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼
![FPGA knowledge accumulation [6]](/img/db/c3721c3e842ddf4c1088a3f54e9f2a.jpg)
FPGA knowledge accumulation [6]

let const

A bug using module project in idea

NCS Chengdu New Electric interview Experience

详解华为应用市场2022年逐步减少32位包体上架应用和策略

Rapid integration of authentication services - harmonyos platform

数字三角形模型 AcWing 275. 传纸条

快速集成认证服务-HarmonyOS平台
随机推荐
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Enterprise manager cannot connect to the database instance
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
Greenplum6.x搭建_环境配置
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
IP地址的类别
channel. Detailed explanation of queuedeclare parameters
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
9c09730c0eea36d495c3ff6efe3708d8
GoLand set goproxy
模拟卷Leetcode【普通】1557. 可以到达所有点的最少点数目
You should use Google related products with caution
更改当前文件夹及文件夹下文件日期shell脚本
Greenplum6.x常用语句
Markdown editor Use of MD plug-in
Tronapi wave field interface - source code without encryption - can be opened twice - interface document attached - package based on thinkphp5 - detailed guidance of the author - July 6, 2022 - Novice
Speaking of a software entrepreneurship project, is there anyone willing to invest?
Test pits - what test points should be paid attention to when adding fields to existing interfaces (or database tables)?
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
LeetCode 736. Lisp 语法解析