Posts

Showing posts from April 13, 2021

Fibonacci Series - Reverse & Sum

Image
 Fibonacci Series - Reverse & Sum  PROBLEM STATEMENT : The program must accept an integer N as the input. The program must print the first N terms in the following series. 0, 1, 1, 2, 3, 5, 8, 13, 39, 124, 514, 836, 1053, 4139, ... and so on. In the above series, the first term is always 0, the second term is always 1 and the remaining terms are formed by adding the reverse of the previous two terms.  Boundary Condition(s):   1 <= N <= 50  Input Format:   The first line contains N. Output Format: The first line contains the first N terms in the above-mentioned series separated by a space.  Example Input/Output 1: Input: ( ) 11 Output: 0 1 1 2 3 5 8 13 39 124 514 Explanation:   Here N=11 and the first two terms in the series are 0 and 1.  The 3rd term in the series is 1 (0 + 1).  The 4th term in the series is 2 (1 + 1).  The 5th term in the series is 3 (1 + 2).  The 6th term in the series is 5 (2 + 3).  ...