1 . A series of whole numbers in which each number is the sum of the two precedi
ID: 3548603 • Letter: 1
Question
1. A series of whole numbers in which each number is the sum of the two preceding numbers.
Beginning with 0 and 1, called Fibonacci series. The sequence of Fibonacci numbers would
be 0,1,1, 2, 3, 5, 8, 13, 21, 34, etc. Using the formula n = n(?1) + n(?2), where the n(?1)
means "the last number before n in the series" and n(?2) refers to "the second last one
before n in the series." You can calculate Fibonacci series.
Write a program that inputs a integer n and prints n number in Fibonacci series. Here is the
sample run.
Your program: please insert n
User: 5
Your program: 3
Hint: you can use recursive function to solve the problem.
2. A palindrome is a string that is spelled the same way forward and backward. Some examples
of palindromes are:
Explanation / Answer
Please post the other questions as separate post and rate this one1) #include<stdio.h> int Fibonacci(int); int main() { int n, i, c; i=0; printf("Enter a number "); scanf("%d",&n); printf("%d ", Fibonacci(n-1)); return 0; } int Fibonacci(int n) { if ( n == 0 ) return 0; else if ( n == 1 ) return 1; else return ( Fibonacci(n-1) + Fibonacci(n-2) ); } Please post the other questions as separate post and rate this one
1) #include<stdio.h> int Fibonacci(int); int main() { int n, i, c; i=0; printf("Enter a number "); scanf("%d",&n); printf("%d ", Fibonacci(n-1)); return 0; } int Fibonacci(int n) { if ( n == 0 ) return 0; else if ( n == 1 ) return 1; else return ( Fibonacci(n-1) + Fibonacci(n-2) ); }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.