做一个程序判断完全数。完全数是指其因数的和等于自身。如6是完全数。其因数为123,和为6。如28是完全数。其因数为1,2,4,7,14,和为28详情看附件
热心网友
#include void main(){ int i,a; int m=0; printf("input the data \n"); scanf("%d",&a); for(i=0;i
热心网友
Function pd(x As Double) As StringDim i As DoubleDim total As DoubleFor i = 1 To x - 1 If x Mod i = 0 Then DoEvents total = total + i End IfNext iIf total = x Then pd = "是完全数"Else pd = "不是完全数"End IfEnd FunctionPrivate Sub Command1_Click()MsgBox pd(Me.Text1.Text)End Sub