当前位置:网站首页>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;
} ![]()
边栏推荐
- cmake命令行使用
- 模拟卷Leetcode【普通】1705. 吃苹果的最大数目
- opencv 将16位图像数据转为8位、8转16
- Lenovo hybrid cloud Lenovo xcloud: 4 major product lines +it service portal
- [Yugong series] February 2022 U3D full stack class 005 unity engine view
- Upload an e-office V9 arbitrary file [vulnerability recurrence practice]
- Other 7 features of TCP [sliding window mechanism ▲]
- Implement custom memory allocator
- Three usage scenarios of annotation @configurationproperties
- NCS Chengdu Xindian interview experience
猜你喜欢

Lenovo hybrid cloud Lenovo xcloud: 4 major product lines +it service portal

Greenplum6.x搭建_安装

Platformization, a fulcrum of strong chain complementing chain

南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案

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

let const

数据分析方法论与前人经验总结2【笔记干货】

Greenplum6.x监控软件搭建

Greenplum 6.x build_ install

Digital triangle model acwing 1027 Grid access
随机推荐
Enterprise manager cannot connect to the database instance
Frequently Asked Coding Problems
IP地址的类别
Compilation and linking of programs
Image segmentation in opencv
Count sort (diagram)
测试踩坑 - 当已有接口(或数据库表中)新增字段时,都需要注意哪些测试点?
PPT模板、素材下载网站(纯干货,建议收藏)
【踩坑】nacos注册一直连接localhost:8848,no available server
Required String parameter ‘XXX‘ is not present
LeetCode 715. Range 模块
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
All about PDF crack, a complete solution to meet all your PDF needs
Routing information protocol rip
Implement custom memory allocator
opencv 将16位图像数据转为8位、8转16
年薪50w阿裏P8親自下場,教你如何從測試進階
[Chongqing Guangdong education] accounting reference materials of Nanjing University of Information Engineering
Why choose cloud native database
如何在HarmonyOS应用中集成App Linking服务