vb 守型数 设A为一个整数,如果a^2=x*a,成立,则称a为 守型数,如5^2=25,25^=625,求1-1000守型数Public Function fun1(a As Long)Dim b As Single,c As Single,n As Integer,d As Longn = 1b = a / 10While b >= 1n = n + 1b = a / (10

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 18:22:02

vb 守型数 设A为一个整数,如果a^2=x*a,成立,则称a为 守型数,如5^2=25,25^=625,求1-1000守型数Public Function fun1(a As Long)Dim b As Single,c As Single,n As Integer,d As Longn = 1b = a / 10While b >= 1n = n + 1b = a / (10
vb 守型数 设A为一个整数,如果a^2=x*a,成立,则称a为 守型数,如5^2=25,25^=625,求1-1000守型数
Public Function fun1(a As Long)
Dim b As Single,c As Single,n As Integer,d As Long
n = 1
b = a / 10
While b >= 1
n = n + 1
b = a / (10 ^ n)
Wend
c = (a ^ 2 - a) / (10 ^ n)
If Fix(c) = c Then
d = a
End If
fun1 = d
End Function
调用时:
Private Sub Form_Click()
Dim a As Long
For a = 1 To 1000
r = fun1(a)
Print fun1(a);
Next a
End Sub
为什么不对呢?

vb 守型数 设A为一个整数,如果a^2=x*a,成立,则称a为 守型数,如5^2=25,25^=625,求1-1000守型数Public Function fun1(a As Long)Dim b As Single,c As Single,n As Integer,d As Longn = 1b = a / 10While b >= 1n = n + 1b = a / (10
对的.仅仅有点小问题.
Public Function fun1(a As Long)
Dim b As Single, c As Single, n As Integer, d As Long
n = 1
b = a / 10
While b >= 1
n = n + 1
b = a / (10 ^ n)
Wend
c = (a ^ 2 - a) / (10 ^ n)
If Fix(c) = c Then
d = a
End If
fun1 = d
End Function
'调用时:
Private Sub Form_Click()
Dim a As Long
For a = 1 To 1000
r = fun1(a)
If r = a Then Print fun1(a);
Next a
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub

vb 守型数 设A为一个整数,如果a^2=x*a,成立,则称a为 守型数,如5^2=25,25^=625,求1-1000守型数Public Function fun1(a As Long)Dim b As Single,c As Single,n As Integer,d As Longn = 1b = a / 10While b >= 1n = n + 1b = a / (10 在vb 中,设变量A的值为-2,则Val(A)的结果是什么, 设A是一个整数,满足(a+1)^2 求用VB随机生成一个范围在[a,b]之间的整数! 在VB中判断数a非负整数可以表示为? 设2+根号7的小数部分为a,整数部分为b,求a-b的值!急   看清楚题再答  如果符合题意 再加20分 VB编程,如果一个三位整数等于其各位数字的立方和,则称这个数为水仙花数.输入一个整数判断其是否为水仙花数.Private Sub Form_Load()Dim x%,a%,b%,c%,y%x = InputBox(请输入三位数,提示框)If Len(x) = 3 Th 如果整数a使得代数式(a^2-2a+3)/(a-2)的值也为整数,那么a=? 设a、b、c、d为整数,且a 如果一个整数的两个平方根为3a-5和2a-6,求这个数 设 a,b,c 为整数,证明:.设 a,b,c 为整数,证明:如果 (b - 1) 被 a 整除,且 (c - 1) 被 a 整除,(b * c - 1) 可以被 a 整除. 如果3次根号200a是一个整数,那么最大的负整数a为?=-O 如果根号200a是一个整数,那么最小正整数a的值为 如果200a的立方根是一个整数 那么最小正整数a为 设a是一个数,用“[a]”表示一个不超过a的最大整数,则[2.7]为?A.2.7 B.2 C.3设a是一个数,用“[a]”表示一个不超过a的最大整数,则[2.7]为?A.2.7B.2C.3D.2.9 试说明:四个整数的积与1的和是一个完全平方数.(提示:设四个连续整数为a,a+1,a+2,a+3) 设函数f(x)=x3+(2+2a-a2)x-2a(a+1),a为实数,如果关于x的方程f(x)=0有三个整数根,则实数a的所有值为 (1/2)VB编程,如果一个三位整数等于其各位数字的立方和,则称这个数为水仙花数,如153=1^3+5...(1/2)VB编程,如果一个三位整数等于其各位数字的立方和,则称这个数为水仙花数,如153=1^3+5^3+3^3 试编程,