im having a head ache how to make a java sample output like this:
sample output:
Please Enter 2 values:(number must range from 1 to 9)else display error message
value 1: 3
value 2: 8
Fibonacci numbers are:
11 19 30 49 79 128 207 335 542
Even numbers are:
* * 30 49 * 128 * 335 542
Odd numbers are:
11 19 * * 79 * 207 * *
Try Again?:


can somebody help me???

Recommended Answers

All 5 Replies

Get the inputs from the user and form the first 2 numbers in the fibonacci sequence, then populate the rest in a loop by sumarizing the previous two numbers. (3+8=11, 11+8=19, 19+11=30 etc)

In order to decide whether a number is odd or not, you can use %(modulus)2. E.g. 5%2 = 1 is odd 4%2 = 0 is even -> every number that are equal to 0 after this modulus operation are even and all numbers that are equal to 1 are odd.

Does this get you started?

System.out.println("Please Enter 2 values:(number must range from 1 to 9)else display error message");
System.out.println("value 1: 3");
System.out.println("value 2: 8");
System.out.println("Fibonacci numbers are:");
System.out.println("11 19 30 49 79 128 207 335 542");
System.out.println("Even numbers are:");
System.out.println("* * 30 49 * 128 * 335 542");
System.out.println("Odd numbers are:");
System.out.println("11 19 * * 79 * 207 * *");
System.out.println("Try Again?:");
System.out.println("Please Enter 2 values:(number must range from 1 to 9)else display error message");
System.out.println("value 1: 3");
System.out.println("value 2: 8");
System.out.println("Fibonacci numbers are:");
System.out.println("11 19 30 49 79 128 207 335 542");
System.out.println("Even numbers are:");
System.out.println("* * 30 49 * 128 * 335 542");
System.out.println("Odd numbers are:");
System.out.println("11 19 * * 79 * 207 * *");
System.out.println("Try Again?:");

what the fuck is this reply,,,are you crazy???

commented: WHat you expect from us. You just reposted question and demand some code from us... -4

I guess you don't know what a joke is, then again, I haven't seen any effort on your part, yet, so I returned in kind. But, hey, it fulfills the requirements you listed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.