当前位置:网站首页>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
- let const
- Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
- ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
- Count sort (diagram)
- Simple use of Xray
- Frequently Asked Coding Problems
- 对API接口或H5接口做签名认证
- 为什么要选择云原生数据库
- [Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
猜你喜欢

阿里p8推荐,测试覆盖率工具—Jacoco,实用性极佳

Compilation and linking of programs
![[Nanjing University] - [software analysis] course learning notes (I) -introduction](/img/57/bf652b36389d2bf95388d2eb4772a1.png)
[Nanjing University] - [software analysis] course learning notes (I) -introduction

調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error

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

Markdown编辑器Editor.md插件的使用
![[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

Esp32-ulp coprocessor low power mode RTC GPIO interrupt wake up

Greenplum 6.x build_ install

Image segmentation in opencv
随机推荐
Greenplum6.x搭建_环境配置
ncs成都新電面試經驗
Enterprise manager cannot connect to the database instance
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
NCS Chengdu New Electric interview Experience
最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼
PPT模板、素材下载网站(纯干货,建议收藏)
LeetCode 715. Range 模块
JS operation
Introduction to data fragmentation
Markdown编辑器Editor.md插件的使用
Qt Charts使用(重写QChartView,实现一些自定义功能)
FPGA knowledge accumulation [6]
Calling the creation engine interface of Huawei game multimedia service returns error code 1002, error message: the params is error
Mock.js用法详解
QT charts use (rewrite qchartview to realize some custom functions)
ESP32-ULP协处理器低功耗模式RTC GPIO中断唤醒
Digital triangle model acwing 275 Pass a note
NCS Chengdu Xindian interview experience
MySQL partition explanation and operation statement