Get the information you need from a community of experts on IDNLearn.com. Discover in-depth and reliable answers to all your questions from our knowledgeable community members who are always ready to assist.

what is the return value of function call f1(2,1)? int f1(int x, int y) { if(x<0 || y<0) return x-y; else return f1(x-1,y) f1(x,y-1); }

Sagot :

The term "function" refers to a SUBROUTINE THAT RETURNS A VALUE.

What is the function's return value?

  • The return type of a function refers to the sort of value that it can only return from a specific function.
  • The right side of an assignment statement, as an actual parameter in a call to a subroutine, or in the middle of a bigger expression are examples of places where a function call typically takes place and where the computer expects to find a value.

static double pythagoras(double x, double y) {

     // Computes the length of the hypotenuse of a right

     // triangle, where the sides of the triangle are x and y.

   return  Math.sqrt( x*x + y*y );

}

static int nextN(int currentN) {

  if (currentN % 2 == 1)     // test if current N is odd

     return 3*currentN + 1;  // if so, return this value

  else

     return currentN / 2;    // if not, return this instead

}

static int nextN(int currentN) {

  int answer;  // answer will be the value returned

  if (currentN % 2 == 1)    // test if current N is odd

     answer = 3*currentN+1; // if so, this is the answer

  else

     answer = currentN / 2; // if not, this is the answer

  return answer;   // (Don't forget to return the answer!)

}

To learn more about Return Values refer to:

https://brainly.com/question/28448134

#SPJ4