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 6789617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:37:32+00:00 2026-05-26T17:37:32+00:00

At the risk of sounding stupid, why does the following method return the result

  • 0

At the risk of sounding stupid, why does the following method return the result instead of the value 1 when the conditional block equates to true?

public long Recursive(int Input)
{
    if (Input <= 1)
        return 1;
    else
        return Input * Recursive(Input - 1);
}
  • 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-26T17:37:33+00:00Added an answer on May 26, 2026 at 5:37 pm

    It does return 1 at the point that Input == 1.

    But the 1 returned is used with the prior call, multiplied by Input, the return value of which is used with the prior call, multiplied by Input, the return value of which is used with the prior call, multiplied by Input, the return value of which is used with the prior call, multiplied by Input… until you have gotten back to the first call to Recursive.

    Try to see what happens when you call Recursive with the value 3:

     - input is not 1, so it calls Recursive with the value 2
       - input is not 1, so it calls Recursive with the value 1
         - input is 1, 1 is returned
       - 2 * 1 is returned
     - 3 * 2 is returned
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the risk of sounding incredibly stupid and receiving a rather patronising answer, how
At the risk of sounding foolish, in a scenario where large data fields need
Is there any security risk of injection in the following PHP script? <?php $empfaenger_1
Is there any difference or associated risk opening with the following PHP variations? <?
I want to set the value of Inclusion list for Moderate risk file Types
At risk of sounding like a fool - The html (html5) designers at our
With the risk of this beeing a stupid question: Every time I create a
At the risk of getting yelled at for posting a stupid question: say I
Just curious - is there any risk in using a public/private key obtained from
At the risk of sounding naive, I ask this question in search of a

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.