Question
1- There is a well-known mathematical sequence called the Fibonacci series. Starting with 0 and 1 as seed values, each successive number is equal to
1-
There is a well-known mathematical sequence called the Fibonacci series. Starting with 0 and 1 as seed values, each successive number is equal to the sum of the previous two numbers. Therefore the Fibonacci series looks like:
0, 1, 1, 2, 3, 5, 8, 13,
Note that the value of the fourth Fibonacci number, F(4) = F(3) + F(2)
Generalized, we can say that F(n) = F(n-1) + F(n-2) for all n > 2
Write an algorithm to get a number which is greater than 0, then calculate and print the Fibonacci value for that number. Remember that the computing agent can enter any value > 0, including 1 or 2.
___________________________________________________________________________________
2- Write an algorithm to determine for a list of characters whether or not it forms a palindrome (spelled the same either forward or backward). For example RADAR is a palindrome. Assume that only upper-case letters are used. Write an algorithm to get the characters, conduct the palindrome test, and output the result Yes it is a palindrome or No it is not a palindrome.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started