Jump to content
  • 3
Alexandru

Problema #497

Question

Salut! Ma ajutati si pe mine va rog mult! Multumesc anticipat!

Subprogramul F este definit mai jos.

int f(int a, int b)
{ if (a==b) return 0;
  if (b/a==0) return a+b;
  return f(a+2,b-3);
}

Scrieți valorile f(5,5) și f(10,21) în această ordine, separate prin exact un spațiu.

  • UpVote 1

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Salut,

La prima iti returneaza:

return 0

Iar la a doua:

return 31

Sper ca e bine! Multa Bafta! Se face cu functii recursive.

Share this post


Link to post
Share on other sites
  • 0
Acum 4 minute, SkyForce a spus:

Salut,

La prima iti returneaza:


return 0

Iar la a doua:


return 31

Sper ca e bine! Multa Bafta! Se face cu functii recursive.

Mersi mult!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Who's Online   0 Members, 0 Anonymous, 4 Guests (See full list)

    There are no registered users currently online

×

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.