Hallo alle,

Long time lurker, first time poster. I hate to be the one who have no posts and starts off their career on a forum with a noob question, but im stuck and there has to be a batter way to do this. I just want to point out this isnt a homework problem, I am just preparing for a java course that i will be taking next semester.

I found this on some other forum, i forget where but here is the main idea of what i need to do: Take a user input and return the next number in a fibonacci sequence for the number the user has entered and continue to enter the next number (after the preceeding one) until the user stops asking for the next number. Example. The user enters 4, Return is 4, next return is 8 next return is 12 ect... I know that the normal fibonacci sequence is 1 1 2 3 5 8 ect and to change it to start with a different number you just multiply each number by the starting digit, but im still struggling.

Here is my sad attempt at this practice problem:

Thanks for the help, I hope this isnt an overwhelming amount of code to post. I also feel as if i have over complicated this.Code:import java.util.Scanner; public class fibseq { //scanners for 2 inputs, first a number then a choice(yes or no) static Scanner in = new Scanner(System.in); static Scanner in2 = new Scanner(System.in); static String choice; // choice of yes or no static String yes = "yes"; // yes string to compare static String no = "no"; // no string to compare static int i = 0; // int i is used to find the next number but save fNumber static int y = 0; // this is the int that i will switch with in repeat static int fNumber; // fNumber means first number public static void main(String[] args) { getNumber(); responce(); } public static void getNumber() { //get the number System.out.println("Enter your number(single digit 1 - 9 no 0): "); fNumber = in.nextInt(); nextNumber(); } public static void nextNumber() { while(i < fNumber) { i = fNumber; } } public static void repeat() { y = i + fNumber; System.out.println(y); while ( >= fNumber) { } } public static void responce() { System.out.println(i + "\n"); System.out.println("Whould you like the number after this as well?"); choice = in2.next(); //idk if i should make another method for this.... if (choice == no) { System.out.println("Goodbye!"); System.exit(0); } if (choice == yes) { /* This is where i get lost i need to basically tell the * system to take the last number which should be stored * in the int i and then add it with the original number * which shoould be stored in fNumber, then output it, * then give the user a change to ask for the number after * that as well. Below is a random attempt i have been * trying to dev refer to the method repeat. */ repeat(); } } }

Thanks again,

5imp7y