Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to generate fibonacci series in VB.NET

1 Answer

0 votes
Imports System
 
Public Class Program
    Public Shared Sub generateFibonacciSeries(ByVal n As Integer)
		Dim prev As Integer = -1, _next As Integer = 1
      	Dim fibonacci As Integer = 1
		
        While fibonacci <= n
        	fibonacci = prev + _next
			Console.Write(fibonacci & " ")
			prev = _next
            _next = fibonacci
        End While
    End Sub
 
    Public Shared Sub Main()
        Dim n As Integer = 500
		
        generateFibonacciSeries(n)
		
    End Sub
End Class
     
     
     
     
' run:
'
' 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610
'

 





answered Aug 5, 2022 by avibootz

Related questions

1 answer 49 views
49 views asked Aug 5, 2022 by avibootz
1 answer 82 views
...