0

0

验证数字是否是盈数(友好数)的C程序?

WBOY

WBOY

发布时间:2023-08-28 16:57:03

|

959人浏览过

|

来源于tutorialspoint

转载

验证数字是否是盈数(友好数)的c程序?

In this program, we are trying to check whether the two given numbers by the user through console, are friendly pair or not?

Example

If sum of all divisors of number1 is equal to number1 and sum of all divisors of number2 is equal to number2, then we can say, those two numbers are abundant numbers.

The logic that we used to find friendly pairs is as follows −

For the sum of all divisors of number 1.

for(i=1;i

对于数字2的所有除数的总和。

for(i=1;i

For the friendly pairs.

齐博B2B电子商务系统
齐博B2B电子商务系统

齐博B2B系统是一款基于PHP程序和Mysql数据库为基础的开源B2B行业门户电子商务网站建站系统, 系统代码完整、开源,功能全面,架构优秀,提供良好的用户体验、及管理平台,是目前搭建B2B行业门户网站最好的程序之一。齐博B2B具有的功能特点包括:通行证整合功能通过通行证的整合,可以与流行的PHPWIND论坛或Discuz论坛以及Ucenter中心等进行通讯,从而为用户提供更多的交流场所,增加网站

下载
if(result1==number1 && result2==number2)

If this condition is satisfied, then they are abundant pairs, otherwise they are not.

Example

Following is the C program to find whether the given numbers are abundant pairs or not −

 Live Demo

#include
int main(){
   int number1,number2,i;
   printf("Enter two numbers:");
   scanf("%d%d",&number1,&number2);
   int result1=0,result2=0;
   for(i=1;i

输出

输出如下 −

Enter two numbers:6 28
Abundant Pairs

相关专题

更多
if什么意思
if什么意思

if的意思是“如果”的条件。它是一个用于引导条件语句的关键词,用于根据特定条件的真假情况来执行不同的代码块。本专题提供if什么意思的相关文章,供大家免费阅读。

757

2023.08.22

console接口是干嘛的
console接口是干嘛的

console接口是一种用于在计算机命令行或浏览器开发工具中输出信息的工具,提供了一种简单的方式来记录和查看应用程序的输出结果和调试信息。本专题为大家提供console接口相关的各种文章、以及下载和课程。

412

2023.08.08

console.log是什么
console.log是什么

console.log 是 javascript 函数,用于在浏览器控制台中输出信息,便于调试和故障排除。想了解更多console.log的相关内容,可以阅读本专题下面的文章。

499

2024.05.29

Golang 性能分析与pprof调优实战
Golang 性能分析与pprof调优实战

本专题系统讲解 Golang 应用的性能分析与调优方法,重点覆盖 pprof 的使用方式,包括 CPU、内存、阻塞与 goroutine 分析,火焰图解读,常见性能瓶颈定位思路,以及在真实项目中进行针对性优化的实践技巧。通过案例讲解,帮助开发者掌握 用数据驱动的方式持续提升 Go 程序性能与稳定性。

9

2026.01.22

html编辑相关教程合集
html编辑相关教程合集

本专题整合了html编辑相关教程合集,阅读专题下面的文章了解更多详细内容。

56

2026.01.21

三角洲入口地址合集
三角洲入口地址合集

本专题整合了三角洲入口地址合集,阅读专题下面的文章了解更多详细内容。

28

2026.01.21

AO3中文版入口地址大全
AO3中文版入口地址大全

本专题整合了AO3中文版入口地址大全,阅读专题下面的的文章了解更多详细内容。

385

2026.01.21

妖精漫画入口地址合集
妖精漫画入口地址合集

本专题整合了妖精漫画入口地址合集,阅读专题下面的文章了解更多详细内容。

116

2026.01.21

java版本选择建议
java版本选择建议

本专题整合了java版本相关合集,阅读专题下面的文章了解更多详细内容。

3

2026.01.21

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Swoft2.x速学之http api篇课程
Swoft2.x速学之http api篇课程

共16课时 | 0.9万人学习

Go语言教程-全程干货无废话
Go语言教程-全程干货无废话

共100课时 | 9.8万人学习

Python进阶视频教程
Python进阶视频教程

共30课时 | 8万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号