当前位置:编程学习 > VB >>

跪求高手写vb代码

编写程序找出三个三位数,他们分别是某两个两位数的平方,且1-9这九个数字在这三个三位数中每个只允许出现一次 vb代码
答案:
写一下这些代码,不用跪,跪下了也不止10分. 
基础的东西好好学吧.
数组 N(1 to 80 ) ,奇数j() 素数ss() ,redim 一下
随机数
dim k as integer ,j as integer
for i = 1 to 80
n(i) = int(rnd()*100) '是0-99的整数.
print n(i),
if i mod 10 =0 then print
if n(i) mod 2 = 1 then
redim preserve j(k)
j(k) = n(i)
k=k 1
endif
if isprime(n(i) then
redim preserve ss(j)
ss(j)=n(i)
j=j 1
endif
next
print "输出素数
for j = 0 to ubound(ss)
print j,
if (j 1 ) mod 10 then print
next

Private Function IsPrime(ByRef n As Integer) As Boolean '此函数用于判断一个数是否是素数
Dim j As Integer
IsPrime = True
For j = 2 To n - 1
If n Mod j = 0 Then IsPrime = False: Exit For
Next
End Function

上一个:vb验证码如何换成英语
下一个:有关于VB数组的.

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,