1030: Makeup Exam: Problem 4

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:139 Solved:47

Description

Consider a series following the recursive relation
a(n+3) = 2 * a(n+2) - a(n+1) +2 * a(n)
and the initial condition a(2)=1, a(1)=1, a(0)=1.
Write a program in C language to compute a(N) where N is an integer smaller than or equal to 17. In this program one take an integer N from keyboard and show the output a(N).
For example:
Input: 3
Output: a(3)=3

Input

3

Output

a(3)=3

Sample Input Copy

5

Sample Output Copy

a(5)=13