Question Fibonacci numbers

kaisermhi

Member
Joined
Sep 22, 2010
Messages
8
Programming Experience
Beginner
how to create console application to calculate 23 numbers of fibonacci?
This is the script I had done but facing an issue:
VB.NET:
Module Module1

    Sub Main()
        'area to declare all integer
        String inputstring;
        String outputstring;
        Int(firstnumber)
        Int(secondnumber)
        Int(current)
        Int(CounterCreationData)
        Int(lastnumber)

        'ask user to enter first fibonacci number which is 1
        Input String = Console.WriteLine ("Please key in the first Fibonacci number: ")
        firstnumber = Integer.parseInt(InputString)

        'ask user to enter second fibonacci number which is 1
        InputString = Console.WriteLine("Please key in the second Fibonacci number: ")
        secondnumber = Integer.parseInt(InputString)

        Console.WriteLine = "The first two Fibonacci numbers are: "         'this will show the first result
                                + firstnumber + "and" + "secondnumber

        If lastnumber ==1
            current = firstnumber

        Else if 
            lastnumber ==2
            current = secondnumber

        Else   '1+2=3
            Counter = 3


    End Sub

End Module

Please help...
 
Last edited by a moderator:
You say that that you are facing an issue but you don't explain what that issue is.

If you want to calculate a series then obviously you have to do the same thing multiple times. How do you do the same thing multiple times in code? Either with recursion or with iteration. I don't see either in your code. Fibonacci numbers are a classic tool for teaching recursion so, unless you've been instructed otherwise, that's the way you should go.
 
sorry.I had forgot to attached a required output for the console application.
This is the output: fibonacci numbers.JPG
 
Back
Top