The Fibonacci sequence is a sequence where the next number in the pattern is the sum of the previous two numbers. The first 7 terms of the Fibonacci sequence are 1, 1, 2, 3, 5, 8, 13.Write pseudocode to print the first 15 terms in the Fibonacci sequence.

What will be an ideal response?


num terms = 15

num x = 1
num y = 1
num z = x + y

num currentTerm = 3

print x
print y
print z

while currentTerm < terms
  x = y
  y = z
  z = x + y
  print z
  currentTerm = currentTerm + 1
endwhile

Computer Science & Information Technology

You might also like to view...

To make the best use of your To-Do list, you should review it often to identify tasks that can be marked as completed, removed, or updated.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The IIF function consists of three arguments: expr, truepart, and falsepart

Indicate whether the statement is true or false

Computer Science & Information Technology

The entire ________ tab is NOT available when worksheets are grouped

A) Insert B) Data C) Review D) View

Computer Science & Information Technology

What access control system lets owners decide who has access to the objects they own?

A. Role-based access control B. Task-based access control C. Discretionary access control D. Rule-based access control

Computer Science & Information Technology