Question: In Java Fibonacci Series Purpose To test the ability to write loops Directions and example The Fibonacci series is a sequence of numbers that appears
Fibonacci Series Purpose To test the ability to write loops Directions and example The Fibonacci series is a sequence of numbers that appears often in various fields. The first two numbers in the series are 1, and then the next number is the sum of the two previous numbers. For example 1, 1 1+1-2, so the third number in the series is 2 1, 1,2 1+2-3, so the next number in the series is 3 1, 1,2, 3 The first ten Fibonacci numbers are: 1, 1,2, 3, 5, 8, 13, 21,34, 55 Write a program that prompts the user for a number n and prints out the first n Fibonacci numbers. If the user enters a negative value for n, display the message Error: n cannot be negative. Below is an example: What is the value of n? 4 11 23 What is the value of n?-4 Error: n cannot be negative Your spacing, capitalization, and wording must be exactly as shown above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
