Write a function gcd(x, y) that returns the greatest common divisor of the parameters x and y. Use the Euclidean algorithm to do this. Return None if the gcd does not exist(i.e., if both parameters are 0)

Answers

Answer 1

Answer:

function gcd(x,y) {

if (!y && !x) return 'None';

if (!y) return x;

return gcd(y, x%y);

}

console.log(gcd(462, 910));

console.log(gcd(0, 0));

console.log(gcd(32, 40));

Explanation:

This example is in javascript.


Related Questions

Natalie wrote a short program for parallel arrays as part of an assignment. What will be the first line of output based on her code?

public class parArray
{
public static void main(String[] args){
int[] empID = {101, 102, 103};
String[] emp_name = {“Jamie Doe”, “Patricia Jack”, “Paul Nick”};
String[] dept = {“Finance”, “Technology”, “HR”};
for ( int i = 0; i {
System.out.print( empID[i] + “\t”);// \t = inserts a tab space
System.out.print( emp_name[i] + “\t”);
System.out.print( dept[i] + “\t”);
System.out.println();
}
}
}

A. 103 Paul Nick HR
B. 101 102 103
C. Jamie Doe Patricia Jack Paul Nick
D. 101 Jamie Doe Finance

Answers

Finance of the pack of them both it will be HR first

Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
diagram be the best choice to represent her information?
O It is the best way to show how something functions.
O It is the easiest way to present complex scientific data.
O It is the best way to show how much energy can be produced.
O It is the easiest way to present large amounts of numerical data.

Answers

A.) it the best way to show how something functions

Answer:

a

Explanation:

Question #2
Multiple Choice
What is the next line?
>>> my Tuple = [10, 20, 50, 20, 20, 60]
>>> my Tuple.index(50)
O 4
O 2
O 3
O 1

Answers

Answer:

The index of 50 is 2.

Explanation:

Index method is sued to return the index of a number or element in a list.

The syntax of using the index method when we have to find the index of a specific element is:

>>>ListName.Index(element)

It has to be remembered that the indexes of a list start from zero.

In the given statements, first a list is created with elements and the second statement will get the index of 50 in the list.

Hence,

The index of 50 is 2.

The next line can be written to display the index of 50 as:

print("The index of 50 is:",my Tuple.index(50))

A loop that will output every other name in the names list.
A loop that will output only the positive numbers in the numbers list.
A loop that will output the sum of all the values in the numbers list.
A loop that will output only the numbers that are odd.
A loop that will output only the names that come before "Thor" in the alphabet from the names list.
A loop that will find the maximum or minimum value in the numbers list. This algorithm requires an additional variable that is assigned to the first element in the list. Then, in a loop compare each element to the variable. If the element is > (for max) or < (for min), assign the variable to the element. After the loop, print the variable.
in python
PLEASE HELPPPP

Answers

Answer:

names = ['Peter', 'Bruce', 'Steve', 'Tony', 'Natasha', 'Clint', 'Wanda', 'Hope', 'Danny', 'Carol']

numbers = [100, 50, 10, 1, 2, 7, 11, 17, 53, -8, -4, -9, -72, -64, -80]

for index, element in enumerate(names):

if index % 2 == 0:

 print(element)

for num in numbers:

 if num >= 0:

   print(num, end = " ")

count = 0

for i in numbers:

 count += i

avg = count/len(numbers)

print("sum = ", count)

print("average = ", avg)

for num in numbers:

 if num % 2 != 0:

   print(num, end = " ")

Explanation:

I'm stuck on the last two.. I have to do those too for an assignment.

Drawing a line to follow the direction of the notes will help you determine what aspect of the music?
A. the key signature
B. the instrumentation
C. the contour
D. the accidentals

subject is music

Answers

Answer:

A. the key signature

Explanation:

When drawing a line to follow the direction of the notes, THE KEY SIGNATURE will help determine the aspect of the music.

Key signature are simply sets of symbols on the musical stave that are written after the clef in a musical notation. They help to determine the aspect of the music because they indicate the direction of the notes.

In cell D15, enter a formula using a counting function to count the number of cells in the Billable? column

Answers

The formula that could be entered as a counting function to count the number of cells would be COUNTA.

What formula can be used in cell D15?

If you want to count the number of cells that are not empty in the Billable column, you can go to cell D15 and type in =COUNTA(.

After that, you highlight the entire Billable column from D2 to D14 and then close the formula and press enter. It will return the number of cells that are not empty.

Find out more on the spreadsheet functions at https://brainly.com/question/1395170.

Bob approaches a beverage vending machine at a fast food kiosk. He has the option of choosing between hot and cold beverages. What control
structure would Bob be using if he chose a cold beverage? In contrast, if he made fresh fruit juice at home using a set of instructions, what
control structure would Bob be using?
Bob would be using the [__]
control structure if he chose a cold beverage. He would be using the [__]
control.
structure if he made fresh fruit juice at home using a set of instructions

Answers

Answer: I took the test and selection was correct for the first blank,

for the second blank its sequence

Explanation:

Which careers require completion of secondary education, but little to no postsecondary education? Mathematical Technicians and Mechanical Engineers Sociologists and Electronics Engineering Technicians Food Science Technicians and Zoologists Nondestructive Testing Specialists and Surveying Technicians

Answers

Answer:

Nondestructive Testing Specialists and Surveying Technicians

Answer:

D

Explanation:

a bus is full of passengers. if you count them by either twos, threes, or fives, there is one left. if you count them by seven there will be none left. find the least number of passengers in the bus?​

Answers

Answer:

91

Explanation:

You know that the number must end in 6 or 1 to get a left over of 1 when divided by 5. Six won't work because  2  divides evenly into a number ending into 6.

So the number ends in 1.

21 doesn't work because 3 divides into 21 evenly.

31 doesn't work because 7 does not divide into it.

41 doesn't work. 41 is prime. 7 won't divide into it.

51 is divisible by 3

61 seven does not evenly divide into 61.

71 seven leaves a remainder of  1

81 7 leaves a remainder.

91 Answer

what are the characteristics needed in a secure hash function?​

Answers

Cryptographic hash functions are utilized in order to keep data secured by providing three fundamental safety characteristics: pre-image resistance, second pre-image resistance, and collision resistance.

The characteristic needed in a secure hash function is image resistance functions.

What are the characteristics?

Characteristics refer to any feature or trait of any object which provides any information about the concept. These are unique in nature and makes difference with one another.

A group of cryptographic operations called Secure Hash Algorithms is designed to safeguard data. It functions by hashing the data to change it. It applies a severe value to a text before using a private key to encrypt the hash code.

One of a good hash function's essential characteristic include  The data being hashed completely determines the hash result, and the hash function uses all of the input data.

The characteristics necessary for a secure hash function are Avoiding collisions Resistance to the preimage and subsequent resistance to the preimage.

Learn more about the Secure Hash function, here:

https://brainly.com/question/2642496

#SPJ6

Match the AI artist with their creation:

Artists:
David Cope, Brian Foo, Jordan Wirfs Brock, Refik Amarillo, Obvious (with GAN created by Robbie Barrat)

Creations:
Experiments in Music Intelligence (EMI), Portrait of Edmond de Bellamy, Mixed Attraction, Machine Hallucinations, Sounds of a Volatile Stock Market

Answers

Explanation:

Experiments in Music Intelligence (EMI) ⇒ David Cope

Portrait of Edmond de Bellamy  ⇒ Obvious (with GAN created by Robbie Barrat)

Mixed Attraction & Machine Hallucinations ⇒ Refik Amarillo and  Brian Foo

Sounds of a Volatile Stock Market ⇒ Jordan Wirfs Brock

What missing function will return the index of 7 in the list?

Answers

Answer:

The answer is: index function and it will be used in the following manner:

>>> myList.index(7)

Explanation:

List is one of the 4 built-in data types that are present in Python language. Lists are used to store same type of values. Indexes are used to access elements of lists in Python.

Various operations can be performed on the lists.

In the given question, we have to write the function that can be used to find the index of an element in the list.

Index function is sued for this purpose.

The syntax for index function is:

list_name.index(element)

So for the given list, to find the index of 7, the function will be written as:

>>> myList.index(7)

Hence,

The answer is: index function and it will be used in the following manner:

>>> myList.index(7)

Answer:

Index

Explanation:

Edge 2020

Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be the bit sequence that actually gets transmitted?

Answers

Let the message be M : 1001 0001   and the generator function is G : 1001

Solution :

CRC sender

                                               

1001     | 1001  0001  000

             1001                            

            0000  0001            

                        1000

                       1001            

                        0001  000

                                 1 001  

                                 0001

Here the generator is 4 bit - 1, so we have to take three 0's which will be replaced by reminder before sending to received--

eg    1001  0001  001    

Now CRC receiver

                                                   

1001         | 1001    0001   001

                1001                          

                 0000 0001

                            1001                  

                            1000

                           1001              

                            0001  001

                           0001  001      

                                   0000

No error

Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask the user to input the current price of an item and its price one year and two years ago. To calculate the inflation rate for a year, subtract the price of the item for that year from the price of the item one year ago and then divide the result by the price a year ago. Your program must contain at least the following functions: a function to get the input, a function to calculate the results, and a function to output the results. Use appropriate parameters to pass the information in and out of the function. Do not use any global variables.

Answers

The inflation calculator program is an illustration of Python functions; where the functions are executed when called or evoked

The inflation program

The inflation calculator program written in Python, where comments are used to explain each action is as follows:

#Thie function gets all input

def getInput():

   cPrice = float(input("Current Price: "))

   pYear1 = float(input("Year 1 Price: "))

   pYear2 = float(input("Year 2 Price: "))

   return cPrice, pYear1, pYear2

#This function prints inflation rate

def printinfRate(myinfRate):

  print("Inflation infRate: ",myinfRate)

#This function calculates inflation rate

def calcinfRate(cPrice, pPrice):

  infinfRate = (pPrice - cPrice)/ pPrice

  printinfRate(round(infinfRate,2))

#The main function begins here

#This gets the prices

cprice, pYear1, pYear2 =  getInput()

#The next 2 lines calls the calcinfRate function to calculate the inflation rate

calcinfRate(cprice, pYear1);

calcinfRate(pYear1, pYear2)

Read more about Python Programs at:

https://brainly.com/question/16397886

Lucy completed her PowerPoint presentation and showed it to her teacher to review. Lucy's teacher said it needed to be more engaging for the audience. The teacher suggested making the slides push in. What feature is Lucy's teacher referring to?

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Lucy completed her PowerPoint presentation and showed it to her teacher to review. Lucy's teacher said it needed to be more engaging for the audience. The teacher suggested making the slides push in.

The teacher referring to the Transitions effect that is push while making the slides.

You can insert different Transition effect on your slides while going through the Transitions tab on the ribbon, and then select your desired effect on the selected/active slide. There are tens of transitions effect, you can search for your desired effect on your slide, such as Lucy's teacher suggested to her to add a push-in effect.

Answer: Transition, I just finished my test for this lesson! I got an 100% on it!

Explanation: When you go and read through the lesson, there's a page telling you about each tab. When you go to "Transitions", there is an image that shows the features for transitioning your slides. The options shown in the picture is "existing", "none", "morph", "cut", "fade", "wipe", and "push".

A file named numbers.txt contains an unknown number of lines, each consisting of a single integer. Write some code that computes the sum of all these integers, and stores this sum in a variable name sum. *PYTHON*

Answers

f = open("numbers.txt", "r")

lst = [int(x) for x in f.read().splitlines()]

sum = 0

for x in lst:

----sum += x

I had to add the four dashes to maintain the structure of my code. You can replace them with spaces. Also, I wouldnt recommend having a variable named sum because python has a built in function named sum. You can test this code by putting print(sum) at the end of the code.

how do hardware and software work together to allow a user to perform a function?
jointly, independently, repeatedly or separately?

Answers

Answer:

jointly

Explanation:

Because Hardware and Soft ware have to JOIN together to make something work

I hope i helped!

Hardware and software collaborate to enable a user to perform a function. The physical components of a computer system, such as the central processing unit (CPU) and memory, are referred to as hardware.

What is CPU?

CPU is an abbreviation for Central Processing Unit, which is the main component of a computer system that is in charge of executing instructions and processing data.

The CPU is often referred to as the computer's "brain" because it performs the majority of the calculations.

When a computer user performs a function, the software sends instructions to the hardware, which then executes the instructions and performs the function.

When a user types on a keyboard to create a document, for example, the keyboard sends signals to the CPU, which processes the input and sends the output to the software application to display on the screen.

Thus, in this way, hardware and software are interdependent and work together to enable a user to perform a variety of functions on a computer system.

For more details regarding CPU, visit:

https://brainly.com/question/16254036

#SPJ7

What game is this?????? ?

Answers

Answer:

name the emoji

Explanation:

Answer:

Stop wasting points

Explanation:

Write a function that returns a pointer to the maximum value of an array of float ingpoint data: double* maximum(double* a, int size) If size is 0, return NULL.

Answers

Answer:

double * maximum( double arr[], int size){

   int max = 0;

   if ( size == 0){

       return 0;

   } else {

        for (int i = 1; i < size; i++){

           if (arr[i] > arr[0]){

               max = arr[i];

           } else {

               max = arr[0];

           }

         }

         return max;

   }

}

Explanation:

The C++ source code above returns the maximum value of an array as a pointer. The function accepts two parameters, the array in question and the size of the array. The for loop iterates over the items in the array and checks for the largest, which is returned as a pointer since the function "maximum" is defined as a pointer to the floating-point number memory location.

Describe
the
Visual basic
select case construct​

Answers

Answer:

Select Case statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each select case.

Answer:

ggggggggggggggggggg

Which type of cut extends an audio clip from a preceding video clip to a subsequent video clip?

K-cut

J-cut

L-cut

A-cut



Adobe Premiere Pro cc 2018

Answers

Answer:

L-cut

Explanation:

In the field of cinematography, professional video editors use video editing software application such as Adobe Premiere Pro to create wonderful and remarkable videos with the aid of various video editing techniques such as J-cut, rolling edit, ripping edit, L-cut etc.

A L-cut can be defined as a split edit technique which typically allows the audio out point of a clip to be extended beyond the video out point of the clip in order to make the audio from the preceding video clip (scene) to continue playing over the beginning of a subsequent video clip.

Hence, L-cut is a type of cut that extends an audio clip from a preceding video clip to a subsequent video clip.

If a document is stored on a file server but team members can edit the document​ anonymously, the content on the file server is:_______a. shared content with version management b. shared on Google drive c. shared content with no control d. shared with the public e. shared content with version control

Answers

Answer:

d

Explanation:

Because a decimal number

If a document is stored on a file server but team members can edit the document​ anonymously, the content on the file server is considered to be a: c. shared content with no control.

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.  Thus, it offer or avail individuals and businesses a fast, effective and efficient way of providing services to their clients over the internet.

Generally, cloud computing comprises three (3) service models and these are;

Infrastructure as a Service (IaaS). Software as a Service (SaaS). Platform as a Service (PaaS).

A file server can be defined as a type of computer that centrally stores, manage and fetch all data files (audio, image, text and video) as they are requested over the internet or network by end users (clients).

An access control refers to a security technique that is used to determine whether a user has the minimum requirements (credentials) to access, use or view resources such as documents on a computer by ensuring they are who they claim to be (authentication).

In this context, when a document (content on a computer) is shared on a file server without the implementation of an access control, the file can be anonymously edited by end users because it won't ask or request for authentication.

However, a shared content on a file server with an access control would only grant permission to authorized users while denying other users access to edit or modify its content.

Find more information: https://brainly.com/question/14014672

How are computers connected to one another?

through networks

through printers

through laptops

Answers

Answer:

They are connected through networks

Explanation:

N/A

Answer:

the other guy is correct

Explanation:

What are three techniques used to generate ideas? O A. Free writing, brainstorming, and concept mapping O B. Free writing, clustering, and detail mapping O c. Free writing, pre-writing, and drafting O D. Pre-writing, drafting and revision​

Answers

freewriting brainstorming and concept mapping

Both pre writing and post reading strategies has been used to enhance comprehension as well as the skill of the learner.

What is Pre-writing or surveying?

Pre-reading or surveying is the process of skimming a text to locate key ideas before carefully reading a text (or a chapter of a text) from start to finish. It provides an overview that can increase reading speed and efficiency.

Reading strategies aim to facilitate the understanding of difficult texts. These strategies are very effective and can facilitate not only reading but also the interpretation of the text. Among the reading strategies, we can mention the use of context clues, which facilitate the understanding of difficult and unknown words.

Synthesizing the text is also a very beneficial strategy, as it allows the text to become smaller, more objective, and direct. Reading strategies should be used even by people who find it easy to read texts with different difficulties, as it allows the text to be understood in a deeper and more complete way.

Therefore, Both prereading and post reading strategies has been used to enhance comprehension as well as the skill of the learner.

More information about context clues at the link:

brainly.com/question/8712844

#SPJ2

Car owners are worried with the fuel consumption obtained by their vehicles. A car owner wants trail of several
tankful (the amount a tank can hold) of fuel by recording kilometers driven and gallons used for each tankful. Write
a program that will take input the kilometers driven and gallons used for each tankful. Your program should compute
and display the kilometers per gallon obtained for each tankful. After processing all input information, the program
should compute and display the combined miles per gallon obtained for all tankful.

Answers

Answer:

Program written in Python:

Please note that -> is used for indentation purpose

count = int(input("Number of vehicles: "))

totaldist = 0; totalgall = 0

for i in range(count):

-> gallon = int(input("Gallons: "))

-> distance = int(input("Kilometers Travelled: "))

-> totaldist = totaldist + distance

-> totalgall = totalgall + gallon

-> rate = distance/gallon

-> print("Kilometer/Gallon: "+str(rate))

print("Miles/Gallon: "+str(totaldist * 1.609/totalgall))

Explanation:

The program uses loop to ask for distance and gallons used by each vehicles.

At the end of the loop, the program divided the total distance by all vehicles in miles by total gallon user by all vehicles

[This line prompts user for number of vehicles]

count = int(input("Number of vehicles: "))

[This line initialised total distance and total gallon to 0]

totaldist = 0; totalgall = 0

[This iterates through number of vehicles]

for i in range(count):

[This prompts user for gallons used]

gallon = int(input("Gallons: "))

[This prompts user for distance traveled]

distance = int(input("Kilometers Travelled: "))

[This calculates total distance]

totaldist = totaldist + distance

[This calculates total gallons]

totalgall = totalgall + gallon

[This calculates the rate by each vehicles: kilometres per gallon]

rate = distance/gallon

[This prints the calculated rate]

print("Kilometer/Gallon: "+str(rate))

[The iteration ends here]

[This calculates and prints the rate of all vehicles. The rate is calculated by dividing total distance in miles by total gallons used]

print("Miles/Gallon: "+str(totaldist * 1.609/totalgall))

Jerry can use an
program to restrict information from going out without his permission.

Answers

The answer is predictions

Answer:

ok but what do you want?

Explanation:

ANTIVIRUS or anti cookie software

is what it is i think

write c++ program to get from user the user and print whether it is positive or negative

Answers

Answer:

I think this is positive

Explanation:

(Language is in Java)

Write an interactive version of the InchesToFeet class that accepts the inches value from a user.



class InchesToFeetInteractive
{
public static void main(String[] args) {
// Modify the code below
final int INCHES_IN_FOOT = 12;
int inches = 86;
int feet;
int inchesLeft;
feet = inches / INCHES_IN_FOOT;
inchesLeft = inches % INCHES_IN_FOOT;
System.out.println(inches + " inches is " +
feet + " feet and " + inchesLeft + " inches");
}
}​

Answers

import java.util.Scanner;

public class InchesToFeetInteractive

{

public static void main(String[] args) {

   Scanner scan = new Scanner(System.in);

   final int INCHES_IN_FOOT = 12;

   int inches = scan.nextInt();

   int feet;

   int inchesLeft;

   feet = inches / INCHES_IN_FOOT;

   inchesLeft = inches % INCHES_IN_FOOT;

   System.out.println(inches + " inches is " +

   feet + " feet and " + inchesLeft + " inches");

   }

}

We import the Scanner class and then initialize a new Scanner named scan. We then get an integer representation of inches from the user and calculate the feet and inches from the value entered by the user.

many web browsers include _________ tools to make it easier for designers to locate the source of a style that has been applied to a specific page element.
a. designer
b. planner
c. developer
d. creator

Answers

Answer:

c. developer

Explanation:

DEVELOPER TOOLS are tools that enables designers to easily and quickly edit web page and as well diagnosed issues or problem on a website which will inturn enables them to build a great and better websites without stress reason been that when a designer makes use of DEVELOPER TOOLS they can quicky track down and as well fix the problem that was diagnosed within a minute or seconds thereby saving time when developing a website profile.

This diagram shows who is responsible in preventing cyberbullying.
A flowchart.
Top box is labeled Cyberbullying can be prevented!
A line leads to two boxes labeled Parents/guardians, Schools.
Lines lead from Schools to boxes labeled Administrators, Teachers, Students.
Based on the diagram, which explains the most effective way to stop cyberbullying?

Answers

Answer:

Parents monitor home computer use, administrators secure school computers, and students report cyberbullying.

Explanation:

this should be right

Other Questions
Give an example of two integers that make a zero pair. Explain how they are additive inverses. hi can someone do this and explain how to do it describe the characteristics of inclusiveness in short. Please answer the questionsCules son algunos roles de la mujer?Cules son algunos roles del hombre?Qu tipo de empleos suele tener una mujer?Qu tipo de empleos suele obtener un hombre?Por qu crees que las tareas domsticas las hacen principalmente las mujeres?Por qu la gran mayora de los puestos de responsabilidad son ocupados por hombres? The function shown is reflected across the y-axis to create a new function. Which is true about the domain and range of each function? Both the domain and range change. Both the range and domain stay the same. The domain stays the same, but the range changes. The range stays the same, but the domain changes. (06.07 LC)Read and choose the correct option with the irregular verb in the future tense to complete the sentence.Joel y yo ________ un reporte sobre el peligro del plstico en los arrecifes.Question 21 options:harharemosdiremosdir Which of these contributed to a lack ofdialogue in government about addressingthe issue slavery?A. David Wilmot's Proviso about future acquired lands fromMexicoB. John C. Calhoun's gag orderC. Fredrick Douglas' power and large following 8. Which congruence postulate or theorem must you use before proving Daisy made mac and cheese for her nephew and used 1.5 cups of macaroni and 2 cups cheese. Later that week she made a larger batch. If she used the same recipe and used 4 cups of cheese. How many cups of macaroni did she use? what is aas in Geometry? which expression is equivalent to (2m+3)(4m-1) Which of the following is made up of land that is now Ohio, Indiana, Illinois,Michigan and Wisconsin, which was sold to raise money for the US? *1. Articles of Confederation2. Confederation Congress3. Northwest Territory4. Northwest Ordinance PLS HELP! WILL GIVE BRAINLIEST! 70 PTS! pls only answer if you knowCompleting the SquareSolve the equation by completing the square. Show your work.x2 30x = 125Step 1: Add to both sides of the equation. (2 points)Step 2: Factor the left side of the equation. Show your work. (2 points)Hint: It is a perfect square trinomial.Step 3: Take the square root of both sides of the equation from Step 2. (1 point)Step 4: Simplify the radical and solve for x. Show your work. (1 point) TIMEREUTIG43:06QuzActive567Which example is a strong thesis statement?Alice's repeated conflicts with other characters show that the Looking Glass land is very different from the real worldAs Alice continues her journey through the Looking-Glass land, she has many difficulties with the other characters,A large number of very odd characters living in the Looking-Glass land are not nice to Alice.The Looking Glass land is very different from the real world that Alice leaves behind when she goes through themirror What is the anthropocene?abThe most common kinship system found in Asia.A type of spatial analysis that measures linguistic and biological diversity,An era in which human activity is altering the planet in permanent ways.A radioactive dating method.d Which inequality is represented by this graph Can someone help me find the GCF of 35 and 63 please show your work thank you Which answer option most likely describes an essay written to persuade?A. An essay summarizing the main events in a movieB. An essay discussing ways to minimize the stress studentsexperience while taking testsC. An essay sharing tips on how to take a good photographO D. An essay giving reasons why teens should be allowed to choosetheir own bedtimes What is the meaning of kindly as it is used in The Lightning Thief? Solve the following:-12 = 6(-3) + 8