How to figure out 15 numbers and

Source: Internet
Author: User

Not again

It's a lot of things this week

Draw time to write VB

Honestly,

VB lesson on the content of not how to understand

In particular, for each of the methods of T in a

It's really not working.

Let's talk about some of the 15 numbers I run out of.

Method 1 :


The specific procedures are:

Option Explicit

Private Sub Command1_Click ()

Cls

Font.Size = 70

Dim I as Integer

Dim A (ten) as Integer

Dim Sum as Integer

Randomize

Fori = 1 to 10

A (i) = Int (RND * 1000)

sum= sum + A (i)

Next I

Print sum

End Sub


Method Two :


The specific procedures are:

Private Sub Command1_Click ()

Cls

Font.Size = 30

Dim N as Integer

Dim S as Integer

Dim A (ten) as Integer

n = 1

While N <= 10

A (N) = Int (RND * 1000)

n = n + 1

Wend

n = 1

While N <= 10

Print A (N)

n = n + 1

Wend

s = 0

n = 1

While N <= 10

s = s + A (n)

n = n + 1

Wend

Print s

End Sub


Method Three :


The specific procedures are:

Dim I as Integer

Dim A as Integer

Dim Sum as Integer

Private Sub Command1_Click ()

Cls

Font.Size = 30

sum = 0

For i = 1 to 10

Randomize

A =int (RND * 1000)

sum= sum + A

Print "10 random Numbers and for:" & Sum

Next

End Sub


method Four :


The specific procedures are:

Dim I as Integer

Dim A as Integer

Dim Sum as Integer

Private Sub Command1_Click ()

Cls

Font.Size = 30

sum = 0

i = 1

Do While I <= 10

Randomize

A = Int (RND * 1000)

sum = sum + a

MsgBox "10 random numbers and as:" & Sum

Loop

End Sub


Method Five :


The specific procedures are:

Dim I as Integer

Dim A as Integer

Dim Sum as Integer

Private Sub Command1_Click ()

Cls

Font.Size = 30

sum = 0

Do Until i > 10

Randomize

A = Int (RND * 1000)

sum = sum + a

MsgBox "10 random numbers and as:" & Sum

Loop

End Sub


Method Six :


The specific procedures are:

Dim I as Integer

Dim A as Integer

Dim Sum as Integer

Private Sub Command1_Click ()

Cls

Font.Size = 30

sum = 0

i = 1

Do

Randomize

A =int (RND * 1000)

sum= sum + A

I =i + 1

Loop While I <= 10

MsgBox "10 random numbers and as:" & Sum

End Sub



method Seven :


The specific procedures are:

Private Sub Command1_Click ()

Cls

Font.Size = 70

Print F (10)

End Sub

Private Function F (x as Integer) as Long

IFX = 1 Then

f= x

Else

F= x + f (x-1)

EndIf

End Function



Method Eight :


The specific procedures are:

Private Sub Command1_Click ()

Cls

Font.Size = 70

Dim I as Integer

Dim A as Integer

Dim Sum as Integer

Do

Randomize

A = Int (rnd* 1000)

sum= sum + A

I =i + 1

Loop Until i > 10

MsgBox "10 random numbers and as:" & Sum

End Sub



Method Nine :

That's what I said before.

Can't run out.

Private Sub Command1_Click ()

Cls

Font.Size = 30

Dim N as Integer

Dim S as Integer

Dim A (ten) as Integer

n = 1

While N <= 10

A (N) = Int (RND * 1000)

n = n + 1

Wend

n = 1

While N <= 10

Print A (N)

n = n + 1

Wend

s = 0

n = 1

Dim T as Integer

For each t in a

s = s + t

Next

Print s

End Sub

Vaguely feel as if what was wrong ....

But I can't find it wrong


All right

The above is the 15-digit method

Go, pull.

How to figure out 15 numbers and

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.