Engineering
Engineering, 22.02.2020 01:18, coryintheswamp

Write a iterative function that finds the n-th integer of the Fibonacci sequence. Then build a minimal program (main function) to test it. That is, write the fib() solution as a separate function and call it in your main() function to test it. For reference see Fibonacci number. INPUT OUTPUT (0, 2) (1, 3) (2, 5) 5 INPUT: OUTPUT: (0, 2) (1, 3) (2, 5) (3, 8) (4, 13) 13 INPUT: OUTPUT: (0, 2) 6765 (1, 3) (2, 5) (3, 8) (4, 13) (5, 21) (6, 34) (7, 55) (8, 89) (9, 144) (10, 233) Note, the first number in the pair is the iteration count (i) and the second number is the value of the (i+2)-th Fibonacci value. Problem 2 Write a recursive function that finds the n-th integer of the Fibonacci sequence. Then build a minimal program to test it. For reference see Fibonacci number. To check for recursion, please have the Fibonacci function print out its input as shown in the examples below: INPUT: OUTPUT: fib(5) fib(4) fib(3) fib(2) fib(1) fib(0) fib(1) fib(2) fib(1) fib(0) fib(3) fib(2) fib(1) INPUT: OUTPUT: fib(7) fib(6) fib(5) fib(4) fib(3) fib(2) fib(1) fib(0) fib(1) fib(2) fib(1) fib(0) fib(3) 13 Problem 3 In this problem, you need to print the pattern of the following form containing the numbers from 1 to n: 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 3 2 2 2 3 4 4 3 2 1 2 3 4 4 3 2 2 2 3 4 4 3 3 3 3 3 4 4 4 4 4 4 4 4 Example when n=4. INPUT Input contains a single integer n. CONSTRAINTS • 1 <= n <= 1000 OUTPUT Print the pattern mentioned in the problem statement. EXAMPLES: INPUT: INPUT: OUTPUT: 2 2 2 2 1 2 2 2 2 INPUT: 5 OUTPUT: 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 5 5 4 3 3 3 3 3 4 5 5 4 3 2 2 2 3 4 5 5 4 3 2 1 2 3 4 5 5 4 3 2 2 2 3 4 5 5 4 3 3 3 3 3 4 5 5 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 INPUT: 7 INPUT: 7 OUTPUT: 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 6 7 7 6 5 5 5 5 5 5 5 5 5 6 7 7 6 5 4 4 4 4 4 4 4 5 6 7 7 6 5 4 3 3 3 3 3 4 5 6 7 7 6 5 4 3 2 2 2 3 4 5 6 7 7 6 5 4 3 2 1 2 3 4 5 6 7 7 6 5 4 3 2 2 2 3 4 5 6 7 7 6 5 4 3 3 3 3 3 4 5 6 7 7 6 5 4 4 4 4 4 4 4 5 6 7 7 6 5 5 5 5 5 5 5 5 5 6 7 7 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7

answer
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 15:10, breannaasmith1122
Two flowing streams of argon gas are adiabatically mixed to form a single flow/stream. one stream is 1.5 kg/s at 400 kpa and 200 c while the second stream is 2kg/s at 500 kpa and 100 ? . it is stated that the exit state of the mixed single flow of argon gas is 150 c and 300 kpa. assuming there is no work output or input during the mixing process, does this process violate either the first or the second law or both? explain and state all your assumptions.
Answers: 1
image
Engineering, 04.07.2019 18:10, tjeffers90028
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
image
Engineering, 04.07.2019 18:10, winterblanco
The higher the astm grain-size number, the coarser the grain is. a)-true b)-false
Answers: 3
image
Engineering, 04.07.2019 18:10, soreese02
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
Do you know the correct answer?
Write a iterative function that finds the n-th integer of the Fibonacci sequence. Then build a minim...

Questions in other subjects:

Konu
Mathematics, 06.05.2020 03:21