Create in words and in a flowchart a solution to the following problems. You may
ID: 3662690 • Letter: C
Question
Create in words and in a flowchart a solution to the following problems. You may submit here or bring a paper copy to class. Fibonacci Numbers: The Fibonacci Numbers are an interesting sequence of positive integers where each value is the sum of the previous two values. We being with F_1 = F_2 = 1 Each successive value is then obtained from the formula F_i = F_i - 1 + F_i - 2, i=3, 4, 5, ... Create a pseudocode (program using words and symbols) to find the first 20 Fibonacci numbers using a seed of 1, 1. Create the flowchart to find the first 20 Fibonacci numbers.Explanation / Answer
procedure fibonacci
a = 1, b = 1, c = 0
print a
print b
for i = 1 to 18
c = a + b
a = b
b = c
print c
end for
end fibonacci
flow chart:
Initial:
print 1
print 1
entering in the loop:
c = 1 + 1 = 2, a = 1, b = 2
print 2
c = 1 + 2 = 3, a = 2, b = 3
print 3
c = 2 + 3 = 5, a = 3, b = 5
print 5
c = 3 + 5 = 8, a = 5, b = 8
print 8
c = 5 + 8 = 13, a = 8, b = 13
print 13
c = 8 + 13 = 21, a = 13, b = 21
print 21
c = 13 + 21 = 34, a = 21, b = 34
print 34
c = 21 + 34 = 55, a = 34, b = 55
print 55
c = 34 + 55 = 89, a = 55, b = 89
print 89
c = 55 + 89 = 144, a = 89, b = 144
print 144
c = 89 + 144 = 233, a = 144, b = 233
print 233
c = 144 + 233 = 377, a = 233, b = 377
print 377
c = 233 + 377 = 610, a = 377, b = 610
print 610
c = 377 + 610 = 987, a = 610, b = 987
print 987
c = 610 + 987 = 1597, a = 987, b = 1597
print 1597
c = 987 + 1597 = 2584, a = 1597, b = 2584
print 2584
c = 1597 + 2584 = 4181, a = 2584, b = 4181
print 4181
c = 2584 + 4181 = 6765, a = 4181, b = 6765
print 6765
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.