![](https://cos-cdn.shuashuati.com/pipixue-web/2020-1231-2005-12/ti_inject-812ce.png)
完全数,又称完美数或 ( Perfect Number ) ,它是指这样的一些特殊的自然数,它所有的真因子(即除了自身以外的约数)的和,恰好等于它本身。 例如, 6 就是一个完全数,是因为 6 = 1 + 2 + 3 。请编写一个判断完全数的函数 IsPerfect() ,然后判断从键盘输入的整数是否是 完全数 。 注意: 1 没有真因子,所以不是完全数。 代码如下,按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。 #include
#include
int IsPerfect( int x); int main() { int m; printf ( "Input m:" ); scanf ( "%d" , &m); if (_________________) /* 完全数判定 */ printf ( "%d is a perfect number\n" , m); else printf ( "%d is not a perfect number\n" , m); return 0; } /* 函数功能:判断完全数,若函数返回0,则代表不是完全数,若返回1,则代表是完全数 */ int IsPerfect( int x) { int i; int total = 0; /* 1没有真因子,不是完全数 */ for (__________________) { if (___________) total = total + i; } return total==x ? 1 : 0; }
A.
第10行: IsPerfect(m)==0 第24行: i=0; i 第26行: x % i != 0
B.
第10行: IsPerfect(m) 第24行: i=1; i 第26行: x % i == 0
C.
第10行: IsPerfect(m)!=1 第24行: i=0; i<=x; i++ 第26行: x / i==0
D.
第10行: m 第24行: i=1; i<=x; i++ 第26行: x % i !=0