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

  • SEARCH
  • Home
  • 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 7087999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:44:36+00:00 2026-05-28T07:44:36+00:00

I have been asked to do this: Please input Number: 4 +-+-+-+ + +

  • 0

I have been asked to do this:

Please input Number: 4
+-+-+-+
+
+
+-+
+
Total is 5

Other Examples”

Please input Number: 5
+-+-+-+-+
+
+
+-+
+
+
+-+-+
+
+
total is  8

While this problem is driving me insane. I have been coding and researching how fibonacci works while figuring out the pattern.

The best code that I ever come up is this:

#include <stdio.h>
#include <conio.h>

int fibo(int condition)
{
    if(condition <= 2)
    {
        return printf("+");
    }
    else
    {
        printf("+");
        printf("-");
        printf("\n");
        fibo(condition - 2) + fibo(condition - 1);
    }
}


int main()
{
    int takeNumber;

    printf("Please give a number!\n");
    scanf("%d",&takeNumber);
    fibo(takeNumber);
    getch();
}

He was very strict on the “only recursion rule”

I am confused and frustrated, I dont know if I should have seperated the ” + “, ” – ” and the “prinf(“\n”); “. I have tried it and got the stack overflow error.

It has been hard to study the pattern, can somebody help me out?

  • 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-05-28T07:44:37+00:00Added an answer on May 28, 2026 at 7:44 am

    like this ?

    #include <stdio.h>
    #include <conio.h>
    
    int fibo(int condition)
    {
        if(condition < 2)
        {
            printf("+\n");
            return 1;
        }
        else
        {
            int n0,n1;
            printf("+-");
            n1 = fibo(condition - 1);
            n0 = fibo(condition - 2);
            return  n0 + n1;
        }
    }
    
    
    int main()
    {
        int takeNumber;
    
        printf("Please input Number: ");
        scanf("%d",&takeNumber);
        printf("Total is %d\n", fibo(takeNumber));
        getch();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may have been asked before, but I had trouble finding an answer,
This question seems to have been asked a lot, but I haven't seen an
This seems to have been asked before: rails decimal precision and scale But when
This has / may have been asked before, but, as far as I remember,
Similar questions to this one have been asked but none seem to address my
I am sure this would have been asked before but couldn't find it. Is
I'm sure this must have been asked before, but I can't find it. Can
I know questions of this kind have been asked before, but my situation differs
I know this kind of questions have been asked already many times before. The
No doubt elements of this question have been asked before, but I'm having trouble

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.