I would like to design a programm in visual basic.net meet the following requirements:

Fibonacci numbers Input limit is 15
Numbers are 0 1 1 2 3 5 8 13

The program must allow input limit
Display all generated Fibonacci numbers
The sum of all the Fibonnacci numbers

Anyone who can help me with this ,i will appreciate.

I don't want to give you the exact answer but your going to need two temp variables to hold the last two numbers of the sequence, also another var to add each number. It's not a difficult application...the concept of temporary variables may be confusing at first.

Here's a few things off the top of my head that you'll need...

1.) Input Box
2.) Loop
3.) Temp. Variables
4.) Variable to act as a sum of fibonacci numbers.

I am having a similar problem. I am using visual basic express 2008 and running vista. I don't know if i am even in the ballpark because or all the bugs that occur whenever i try to run vb apps. can anyone help?


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim y As Integer
Dim z As Integer


x = 1
y = 1

For count As Integer = 1 To 10

y = x
x = z
z = x + y
Label1.Text = (x + y).ToString _
& ControlChars.NewLine
count += 1
Next count

End Sub

Well, you can solve this problem using two methods:
1. Iterative approach...like what you guys are trying
2. Recursive approach which to me is easier.....next term (N) in Fibonacci series is given by N = Fibonacci(N-1) - Fibonacci(N-2) where N > 0. Then you can loop any number of times to generate the different terms.

Edited 6 Years Ago by mnmw: n/a

I am having a similar problem. I am using visual basic express 2008 and running vista. I don't know if i am even in the ballpark because or all the bugs that occur whenever i try to run vb apps. can anyone help?


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim y As Integer
Dim z As Integer


x = 1
y = 1

For count As Integer = 1 To 10

y = x
x = z
z = x + y
Label1.Text = (x + y).ToString _
& ControlChars.NewLine
count += 1
Next count

End Sub

You only need to concatenate your label output. Also remember to clear label before you start looping:

Label1.Text = ""
For count As Integer = 1 To 10

y = x
x = z
z = x + y
Label1.Text = Label1.Text + (x + y).ToString _
& ControlChars.NewLine
count += 1
Next count

This article has been dead for over six months. Start a new discussion instead.