1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
olasank [31]
3 years ago
8

Refer to the method f: Public int f( int k, int n ) { if( n == k ) return k; else if( n > k ) return f( k, n - k ); else retu

rn f( k - n, n ); } What value is returned by the call f( 6, 8 )?
Computers and Technology
1 answer:
Debora [2.8K]3 years ago
5 0

Answer:

Returned value: 2

Explanation:

Public int f(int k, int n) {

   if (n == k)

       return k;

   else if (n > k)

       return f(k, n - k);

   else return f(k - n, n);

}

/////////////////////////////////////////////////////////////////////////////////////////

Trace of function calls,

f(6, 8)

f(k, n - k) -> (6, 2)

f(k - n, n) -> (4, 2)

f(k - n, n) -> (2, 2)

return k

You might be interested in
How to tell if screen or screen protector is cracked?
beks73 [17]
You will feel the screen protector crack
6 0
3 years ago
Read 2 more answers
PLEASE HELP ASAP (answer is needed in Java) 70 POINTS
8_murik_8 [283]

import java.util.Scanner;

public class MyClass1 {

   public static void main(String args[]) {

     Scanner scan = new Scanner(System.in);

     int smallest = 0, largest = 0, num, count = 0;

     while (true){

         System.out.println("Enter a number (-1 to quit): ");

         num = scan.nextInt();

         if (num == -1){

             System.exit(0);

         }

         else if (num < 0){

             System.out.println("Please enter a positive number!");

         }

         else{

             if (num > largest){

                 largest = num;

                 

             }

             if (num < smallest || count == 0){

                 smallest = num;

                 count++;

             }

             System.out.println("Smallest # so far: "+smallest);

             System.out.println("Largest # so far: "+largest);

         }

     }

   }

}

I hope this helps! If you have any other questions, I'll do my best to answer them.

6 0
3 years ago
Which of the following would be MOST useful to determine why packets from a computer outside the network are being dropped on th
jek_recluse [69]

Answer:

c.

Explanation:

3 0
3 years ago
Windows _ is a built-in tool that uses libraries, or groups of related files, to enable you to search for programs, files, or fo
mario62 [17]
Windows explorer is a <span>built-in tool that uses libraries, or groups of related files, to enable you to search for programs, files, or folders on your computer.</span>
7 0
3 years ago
Which of these cannot be used to open a zip file?
Inga [223]

Answer:

c

Explanation:

bc

4 0
2 years ago
Other questions:
  • You can execute three main types of linux commands. what are they?
    8·1 answer
  • Which column and row references are updated when you copy the formula: =F$5+12? Value 12 Column F Column F and row 5 Row 5
    8·1 answer
  • If you are a driver under 21 with a breath or blood alcohol level of ____ or higher, you will be required to attend a substance
    11·2 answers
  • Write a script which: Uses the input function to get any number and store it in a variable named my_number Create a new variable
    8·1 answer
  • Which is the primary use of a word processor? create, edit, format, and print text-based documents maintain a database of record
    5·1 answer
  • Digital certificates can be used for each of these EXCEPT _____. A. to encrypt channels to provide secure communication between
    13·1 answer
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • Does anyone know how to fix this???
    11·1 answer
  • 2. Which Interface uses
    7·1 answer
  • A. In I/O interation between OS and devices, describe how hybrid mechanism works?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!