确定给定数字是否为丰数(Abundant number)的程序2025 年 1 月 8 日 | 3 分钟阅读 丰满数又称为过剩数,其定义是数本身的所有真因子(不包括该数本身)之和大于该数本身。 第一个丰满数是整数 12,其真因子(1, 2, 3, 4, 6)之和(16)大于该数本身(12)。 示例 12, 18, 20, 24, 30, 36 在此程序中,我们将使用以下算法来检查给定数字是否为丰满数。 算法主程序
CheckAbundant (n)
GetSum(n)
Java 程序输出 Enter the number? 20 The number is Abundant C程序输出 Enter the number? 34 The number is not Abundant. Python 程序输出 Enter the number?24 The number is Abundant. C# 程序输出 Enter the number? 67 The number is not Abundant. PHP 程序输出 Enter the number? 56 The number is Abundant. 下一主题# |
我们请求您订阅我们的新闻通讯以获取最新更新。