-
private sub command1_click()dim i, j, s as long
i = 1s = 0
do while i < 1000 'Prime number requirements.
i = i + 1
for j = 2 to i - 1
if (i mod j) = 0 then exit fornext j
if j = i then
i 'Displays all prime numbers that meet the requirements.
s = s + i
end if
loopprint s 'Displays the sum of prime numbers that meet the requirements.
end sub
-
private sub command1_click()dim i, j, f, c,sum
i = 2while i < 1000
f = true
j = 2do while j < i
if i mod j = 0 then f = false: exit do
j = j + 1
loopif f then
i & vbtab;
c = c + 1
sum=sum+i
if c mod 5 = 0 then
end if
i = i + 1
wendprint vbcrlf & "The sum of all prime numbers within 1000=" & sum
end sub
-
I'm calling on my phone, you'd better run it, dimi
asinteger:n
asinteger
dowhile
i〈1000
i=1:x=0
s:i=i+1
ll:n=i-1:t=i
modnifn=1
thengoto
s:x=x+iift
0thengotollif
t=0then
gotosloop
printx I think my ** will be a little simpler than the one above. Hope it helps. If you don't understand, you can ask. Thank you!
-
Actually, if n mod b(a) = 0 then there is no end if
Same if c = 0 then
End if is also missing
-
'Outputs all prime numbers between 1000 and 1100, and outputs six private sub command2 click()dim x%, z% per line
dim m%, n%
x = 1000
z = 0do while x <= 1100
x = x + 1
m = x - 1
n = 0do while m > 2
if x mod m = 0 then n = n + 1m = m - 1
loopif n = 0 then
print x;
z = z + 1
if z mod 6 = 0 then printend if
loopend sub result:
Weakly asked, how can I help you? Can I help you type? I don't think you said anything to help you.
There are two ways to do this, first: with a triple cycle; Second, just write a function call. I'll do it for you here with the second one, first making a method that returns the value of each item: >>>More
private sub form_load()
Songti")"Italics GB2312") >>>More
There are two optional values for this property: 0-flat means that it is not displayed in 3D when the form is running, and 1-flat means that it is displayed in 3D when the form is running. >>>More
Not sure what it does?
What are the specific requirements. >>>More