Reference no: EM132208517
Write the program in C++: The Terms of the Fibonacci Sequence are the numbers 1,1, 2, 3. 5, 8, 13, ------. The next term in the sequence is found by summing the previous two terms.
Numbers in an ACSLacci Sequence are formed by summing the previous three terms and subtracting 3. For example. The ACSLacci sequence starting with 1, 0, and 4 is as follows.
1, 0, 4, 2, 3, 6, 6, 8, 14, 25, -----.
Input: Five Sets of data. Each set consists of four integers a1, a2, a3, and N. The first three numbers are the first three terms of an ACSLacci sequence. The fourth number is the term to be print out.
Output: For each output set, print the Nth term of the ACSLacci sequence defined by the first three numbers in the input set.
Sample of input and output.
input: Line 1# 1 , 0, 4, 9
Line 2#: 1, 1, 2, 5
output #1: 25
output #2: 1