COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY

TRACING AN ALGORITHM

ON THIS PAGE
SECTION 1 | WHAT ARE FLOWCAHRTS
SECTION 2 | CREATING FLOWCHARTS
SECTION 3 | TRACING FLOWCHARTS
SECTION 4 | EXAMPLE EXAMINATION STYLE QUESTION - COMING SOON
ALSO IN THIS TOPIC
THINKING PROCEDURALLY
THINKING LOGICALLY
THINKING AHEAD
THINKING CONCURRENTLY​ 

 THINKING ABSTRACTLY
 YOU ARE HERE | FLOWCHARTS
MORE COMING SOON

Picture
SECTION 1 | W​​

    
The code above is  an implementation of the Fibonacci sequence. 
  1. prevNum is initialized to 0 and currentNum is initialized to 1. These are the first two numbers in the Fibonacci sequence.
  2. print(currentNum) will print the value of currentNum, which is 1.
  3. The for loop runs 6 times.
  4. Inside the loop:
    • nextNum is calculated as the sum of prevNum and currentNum.
    • The value of currentNum is then assigned to prevNum.
    • The value of nextNum is assigned to currentNum.
    • The new value of currentNum is printed.
When you run the code, you'll get the following output: 1, 1, 2, 3, 5, 8, 13
SECTION 2 | C
SECTION 3 | T
SECTION 4 | E
Picture
Picture
NAVIGATION
COMING SOON
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.