Fibonacci Number

account_circle Unassigned
schedule 1 Hour
account_balance_wallet $5

I have a Fibonacci number program in java and it works very well, I just want it to give me the following 50 Fibonacci numbers when I get my answer. How do I program it to do that? here's my code:

  import java.util.Scanner;

public class FibonacciNumber {

private static Scanner console;

/** * @param args */

 public static void main(String[] args) {

// TODO Auto-generated method stub


  int previous1;

int previous2;

  int current = 0;

  int counter;

  int nthFibonacci;

Object FubonacciNumber;

Scanner console = new Scanner(;

  //Prompt the user for input

System.out.println("Enter the first Fibonacci number: ");

previous1 = console.nextInt();

System.out.println("Enter the second Fibonacci number: ");

previous2 = console.nextInt();

System.out.println("The first two numbers of the Fibonacci sequence are: " + previous1 + "and" + previous2);

System.out.println("Enter the position of the desired number in " + "the Fibonacci sequence: ");

  nthFibonacci = console.nextInt();

  if (nthFibonacci == 1) current = previous1;

else if (nthFibonacci == 2) current = previous2;

  else   { counter = 3;

while (counter <= nthFibonacci) {

current = previous2 + previous1; previous1 = previous2;

previous2 = current; counter++;

  } } System.out.println("\nThe " + nthFibonacci + "th Fibonacci number of " + "the sequence is: " + current); }

private static int nextInt(int counter) {

// TODO Auto-generated method stub return 0; } }

Mar 19th, 2018

Thank you for the opportunity to help you with your question!

you can not ask such a long question in free zone 

I can do your assignment, Assignment will be fresh and original, that's my guarantee . If you want any sample work I can provide you . Waiting for positive reply . Thanks

Please let me know if you need any clarification. I'm always happy to answer your questions.
Jun 16th, 2015

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
Mar 19th, 2018
Mar 19th, 2018
Mar 20th, 2018
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer