当前位置:网站首页>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;
} ![]()
边栏推荐
- NCS Chengdu New Electric interview Experience
- mysql分区讲解及操作语句
- 更改当前文件夹及文件夹下文件日期shell脚本
- leetcode134. gas station
- ncs成都新電面試經驗
- [Nanjing University] - [software analysis] course learning notes (I) -introduction
- Greenplum 6.x common statements
- [Yugong series] February 2022 U3D full stack class 006 unity toolbar
- opencv之图像分割
- 【MySQL】数据库进阶之触发器内容详解
猜你喜欢

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

Platformization, a fulcrum of strong chain complementing chain

Three series of BOM elements

为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾

Calling the creation engine interface of Huawei game multimedia service returns error code 1002, error message: the params is error

Nanjing commercial housing sales enabled electronic contracts, and Junzi sign assisted in the online signing and filing of housing transactions

Greenplum6.x监控软件搭建

The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider

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

JS operation
随机推荐
leetcode134. gas station
Upload an e-office V9 arbitrary file [vulnerability recurrence practice]
【微信小程序:缓存操作】
Other 7 features of TCP [sliding window mechanism ▲]
Selenium automation integration, eight years of testing experience, soft test engineer, an article to teach you
opencv 将16位图像数据转为8位、8转16
阿里p8推荐,测试覆盖率工具—Jacoco,实用性极佳
Compilation and linking of programs
All about PDF crack, a complete solution to meet all your PDF needs
如何在HarmonyOS应用中集成App Linking服务
leetcode135. Distribute candy
Shell script for changing the current folder and the file date under the folder
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
Test pits - what test points should be paid attention to when adding fields to existing interfaces (or database tables)?
Category of IP address
GoLand set goproxy
LeetCode 715. Range module
如何在图片的目标中添加目标的mask
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
如何在快应用中实现滑动操作组件