当前位置:网站首页>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;
}
边栏推荐
- Shell script for changing the current folder and the file date under the folder
- Routing information protocol rip
- 9c09730c0eea36d495c3ff6efe3708d8
- Teach you how to select PCB board by hand (II)
- opencv 将16位图像数据转为8位、8转16
- [Nanjing University] - [software analysis] course learning notes (I) -introduction
- opencv之图像分割
- [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
- 23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
- RuntimeError: Calculated padded input size per channel: (1 x 1). Kernel size: (5 x 5). Kernel size c
猜你喜欢
oracle一次性说清楚,多种分隔符的一个字段拆分多行,再多行多列多种分隔符拆多行,最终处理超亿亿。。亿级别数据量
Digital triangle model acwing 275 Pass a note
关于基于kangle和EP面板使用CDN
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
Novice entry SCM must understand those things
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error
调用华为游戏多媒体服务的创建引擎接口返回错误码1002,错误信息:the params is error
Greenplum6.x搭建_安装
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
随机推荐
All about PDF crack, a complete solution to meet all your PDF needs
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
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
联想混合云Lenovo xCloud:4大产品线+IT服务门户
cmake命令行使用
Componentspace2022, assertions, protocols, bindings, and configuration files
Greenplum6.x监控软件搭建
数字三角形模型 AcWing 275. 传纸条
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
FPGA knowledge accumulation [6]
Opencv converts 16 bit image data to 8 bits and 8 to 16
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
Pointer advanced, string function
The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
IP地址的类别
With an annual salary of 50W, Alibaba P8 will come out in person to teach you how to advance from testing
Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022
xray的简单使用
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
Routing information protocol rip