Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:40:27+00:00 2026-06-13T00:40:27+00:00

So I have a homework to make a flowchart of an algorithm printing first

  • 0

So I have a homework to make a flowchart of an algorithm printing first N terms of Fibonacci sequence. It’s not hard, sure, but the teacher told us this could be done in as little as six flowchart “balloons”. And here is the problem – I wanted to do it this way but I just don’t seem to be able to… Namely, I think the shortest way is to check if N>2 – if not, we have to check if it’s 1 or 2 and print 0 or 1 respectively. Only after that can we use the “regular” F(n)=F(n-1)+F(n-2) formula – otherwise, it would crash. Writing more formally:

  1. input N
  2. N>2?
    • No: check if it’s 1. If so, print 0 and stop.
    • No: check if it’s 2. If so, print 0 and 1 and stop.
    • Yes: proceed to 3
  3. Let i=3. While i < N: fib(i)=fib(i-1)+fib(i-2) and print fib(i).
  4. Stop.

The problem is, I suppose it would take something around 10 boxes to make this, if not more. What could be the shorter way, then? All the algorithms I find online tend to presume we would get only N more than 2 which may not be the case. Could you please help?

EDIT: OK, I tweaked it to 8 boxes and think it’s as little as one can go. Something like this:

  1. Input N
  2. Let older=0, younger=1 (respectively: the (n-2)th and (n-1)th term of the series), current=1, i=2.
  3. Is N<=1?
    • Yes: output older, end.
    • No: proceed to 4
  4. Output older, younger.
  5. i < N?
    • Yes: current = older+younger, older = younger, younger = current, i+=1. Print current, go to 5.
    • No: end.

Could something be tweaked further here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:40:28+00:00Added an answer on June 13, 2026 at 12:40 am
    1. Input N
    2. Let (x1, x2) = (0, 1)
    3. Is N ≤ 0?
      • Yes: Stop
      • No: Proceed to step 4
    4. Print x1
    5. Let (x1, x2, N) = (x2, x1 + x2, N – 1), and proceed to step 3.

    If “Stop” needs to be its own step, that would make step 6.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a homework assignment where I have to use fork() but
I have a homework that asks this: Make an algorithm and pseudocode, which will
I have a homework task to prove whether or not a particular variation on
I know you don't like helping others in their homework but I have to
I have a homework problem where I have to make an inheritance program that
I have some homework for my school and I have to make a snake
For a homework assignment I have to make a makefile (physically and in software)
I have a homework assignment. I'm not looking for anyone to do the work
First I want to make it clear that this is a homework based question.
I have big problem because i dont uderstand properly how make my homework. Well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.