English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

draw a flowchart to print the first N terms of the Fibonacci series. N being any positive number inputted by a user.

PLs help me, i really dont know how to solve this. If you can, pls send it to my email. Thank you very much !!!

2007-01-01 22:09:42 · 1 answers · asked by Angeline_Love16 1 in Computers & Internet Programming & Design

1 answers

To draw a flowchart, you only need to draw the process the program will take.

You will need to understand the program.
- First two numbers in series are 1 and 1, for inputs 0 and 1 respectively.
- Next number in series is the combination of the prevous two numbers.

A flowchart would be something like this: Obviously, you may want to place boxes around them and arrows, etc. Due to no drawing in text, I will not place arrows or boxes.

1. Set variables for prev1, prev2, total, and N, Get input N.
2.1. If N is 0 or 1, return 1, goto 8.
2.2. Else, set prev1 and prev2 to 1, goto 3.
3. While N is greater than 1. Goto 4
4. Set total to prev1 plus prev2. Set prev2 to prev1. Set prev1 to total. Goto 5.
5. Decrement N by 1.
6. End of while loop
7. Return total. Goto 8.
8. End

2007-01-02 03:52:14 · answer #1 · answered by Mark aka jack573 7 · 0 0

fedest.com, questions and answers