Sequenza di Fibonacci – Visual Basic

sequenza di fibonacciSequenza di Fibonacci

Ora creeremo la "sequenza di Fibonacci" in Visual Basic.

Numero Tipo Text
1 Form Sequenza di Fibonacci
1 Button Avvia
1 Textbox  
1 Label Inserire quanti numeri della sequenza si vuole

 

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If (TextBox1.Text < 45) Then


            Dim n As Integer
            Dim n1 As Integer = 1
            Dim n2 As Integer = 1
            Dim n3 As Integer = 0
            Dim conta As Integer = 0
            Dim ris(100) As Integer
            Dim risultato As String
            n = TextBox1.Text
            While conta < n
                n3 = n2
                n2 = n1 + n2
                n1 = n3
                ris(conta) = n2
                conta += 1
            End While
            For i = 0 To n - 1
                risultato += ris(i) & " "
            Next
            MsgBox(risultato)
        Else
            MsgBox("inserire un valore inferiore a 45")
        End If
    End Sub
End Class
fibonaccifibonacciSorgenti:

sequenza di fibonacci.rar

Precedente Creare una tabella - HTML Successivo CityGlance la nuova app italiana

9 commenti su “Sequenza di Fibonacci – Visual Basic

  1. An outstanding share! I have just forwarded this onto a coworker who has been conducting
    a little homework on this. And he in fact bought me dinner due to the fact that I found it for him…
    lol. So allow me to reword this…. Thanks for the meal!!

    But yeah, thanks for spending time to discuss this
    matter here on your website.

  2. Wonderful blog! Do you have any suggestions for aspiring writers?
    I’m planning to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for a paid option? There are
    so many options out there that I’m totally overwhelmed
    .. Any suggestions? Appreciate it!

  3. I used to be recommended this website by means of
    my cousin. I’m no longer certain whether or not this post is written by means of him as nobody else realize such
    special about my difficulty. You’re incredible! Thank you!

  4. Link exchange is nothing else except it is simply placing the other person’s
    website link on your page at suitable place and other person will also do similar for you.

  5. Great weblog right here! Also your site quite a bit up very fast!
    What web host are you using? Can I get your affiliate hyperlink in your host?
    I want my site loaded up as quickly as yours lol

I commenti sono chiusi.