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
frutty [35]
4 years ago
7

The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write a recursive

method gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0 then gcd(x,y) is x; otherwise gcd(x,y) is gcd(y,x%y), where % is the remainder operator
Computers and Technology
1 answer:
Virty [35]4 years ago
4 0

Answer:this is made in java programing language

Program:

/**********************************************************

* The following GreatestCommonDivisor class demonstrates *

* a method called gcd. It reads two integers from the user*

* and displays the GCD of two integers. The method gcd *

* calculates and returns the GCD of two integers. *

**********************************************************/

// GreatestCommonDivisor class

import java.util.Scanner;

public class GreatestCommonDivisor

{

// start main main method

public static void main(String[] args)

{

// declare variables

int firstInteger;

int secondInteger;

int gcdOfTwoIntegers;

// create an object for Scanner class

Scanner input = new Scanner(System.in);

Prompt the user to enter the two positive integers.

// prompt the user to enter the first integer

System.out.print("Enter the first positive integer: ");

firstInteger = input.nextInt();

// prompt the user to enter the second integer

System.out.print("Enter the second positive integer: ");

secondInteger = input.nextInt();

Call the gcd method to get the greatest common divisor of two integers.

// call gcd method to get gcd of two integers

gcdOfTwoIntegers =

gcd(firstInteger, secondInteger);

Display the greatest common divisor of two integers.

// display the gcd of two integers

System.out.println("The GCD of " + firstInteger + " and " + secondInteger +

" is " + gcdOfTwoIntegers);

} // end of main method

The following gcd method accepts two integers as its parameters. It finds and returns the greatest common divisor of these integers recursively.

// gcd method implementation

public static int gcd(int x, int y)

{

// verify whether the value of y is zero or not

if(y == 0)

// return x if the value of y is zero

return x;

else

/* call gcd method recursively if the value of y is non-zero */

return gcd(y, x % y);

} // end of gcd method

} // end of GreatestCommonDivisor class

Explanation:

You might be interested in
Programs that do the same thing every time they run are called...
Misha Larkins [42]

Answer:

predictable

Explanation:

because it repeat itself all time

6 0
3 years ago
Your customer, Maggie, wants to buy a gaming PC, and she specifically mentions that she wants an Intel CPU and intends to overcl
Ksenya-84 [330]

Answer:

Intel produces a series of unlocked CPU's that can be overclocked. These CPUs are from the "K" or "X" series. Example: Intel Core i9-9900K, Intel Core i9-10940X.

These are the few things that are to be kept in mind while overclocking:

-Motherboard: Motherboard should support overclocking. Example: Intel Z series, most AMD motherboards.

-Cooler: Boosting the clock speed increases the temperature. The cooler has to be upgraded to keep the temperatures low. Example: Water-cooled. Also, the heat sink has to be checked if it's working properly.

-Be ready to test your system in BIOS. Make sure the temperature, voltage, memory speed is stable for the set clock speed.

Explanation:

8 0
3 years ago
Access fundamentally refers to the ability of a subject and a(n) ___________ to interact.
mars1129 [50]

Answer:

The correct word for the blank space is: object.

Explanation:

Access Control System (<em>ACS</em>) is a computer structure that allows or restricts users to access to features and information of a server. ACS is used to protect confidential data and to make sure the servers are going to be used by authorized users which diminish malfunctions. One of the basic principles of ACS is letting subjects and objects to interact properly.

5 0
4 years ago
When working with tables, if I wanted odd and even rows to be formatted differently, I would select the ___ option from the Tabl
coldgirl [10]
I would say that It is the Banded rows option.
8 0
3 years ago
pen the PT Activity. Perform the tasks in the activity instructions and then answer the question. Which event will take place if
zysi [14]

Answer:

Packets with unknown source addresses will be dropped.

Explanation:

This question is incomplete, we must add the number "1" in Fa0/1.

Which event will take place if there is a port security violation on switch S1 interface Fa0/1?

There are four options:

- A notification is sent.

- A syslog message is logged.

-The interface will go into error-disabled state.

- Packets with unknown source addresses will be dropped.

In this specific example, we have configured a security protection mode, if there is an unknown MAC address,  every package will be dropped.

We can configure in our switch with different Mac address, if there is not a MAC address in our configuration, the security mode will active, and we could receive any package.

5 0
4 years ago
Other questions:
  • When you enable user access control (uac)
    11·1 answer
  • A circuit has a resistance of 300 ohm and a current of 0.024 A. What is the voltage in the circuit?
    12·1 answer
  • Can someone please help me with this pleaseeeee
    12·1 answer
  • is skill in using productivity software, such as word processors, spreadsheets, database management systems, and presentation so
    10·1 answer
  • BRAINLIEST Which function will add a name to a list of baseball players in Python?
    11·2 answers
  • Among the eight unique features of​ e-commerce, which is related to the ability to interact with web technology​ everywhere?
    14·1 answer
  • Write a program name Dollars that calculates and displays the conversion of an entered number of dollars into currency denominat
    11·1 answer
  • What are some of the benefits of project
    7·1 answer
  • How to deactivate the brainly app?​
    12·2 answers
  • I made a mistake. I'm building my first PC and I bought a Ryzen 7 3800x and planning on getting a 2070 super (if I can). What I
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!