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
Kobotan [32]
3 years ago
8

Write a method isMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The me

thod should take two integer arguments and return 1 if the second is a multiple of the first and 0 otherwise.
Computers and Technology
2 answers:
SVEN [57.7K]3 years ago
8 0

Answer:

See the explanation

Explanation:

Given to integers a,b we can find integers k,r such that a = kb +r, where r is called the residue, where |r|<|b|. When r = 0, we say that a is a multiple of b. Based on that, we define the function %(a,b) which gives out the residue between a,b. For example %(4,3) =1 since 4 = 1*3 +1.

The main idea of the program should be: if the residue is 0, then they are multiples and it should return 1, otherwise, return 0.

Let us use the following syntaxis function name (parameter 1, parameter 2).

So, we have

isMultiple(a,b) {

if %(a,b)=0 (this means they are multiples)

then return 1

else return 0

end

}

NNADVOKAT [17]3 years ago
3 0
I don't know what language you want it in but I will write this in Java.

public int isMultiple(int x, int y) {
    if (x % y == 0)
        return 1;
    return 0;
}

The mod function (%) returns 0 iff x divides y.
Feel free to ask me questions!
You might be interested in
USDA-APHIS Animal Care Resource Policy #12 "Considerations of Alternatives to Painful/Distressful Procedures" states that when a
katrin2010 [14]

Answer:

C. The specific field of study

C. change in anesthetic agent

Explanation:

In the consideration for the procedure, some information are required and examples are the strategy of the search/the database name. However, the area of study is not one of the information.

The animal use proposal can general be altered based on the type of change required. However, an anesthetic agent alteration is not a significant change.

6 0
3 years ago
1. Grade data is:
horrorfan [7]

Answer:

1.)

import math

def min_max(lst):

   minimum = math.inf

   maximum = -math.inf

   for x in lst:

       if minimum > x:

           minimum = x

       elif maximum < x:

           maximum = x

   return minimum, maximum

2.)

def deltaGrade(lst):

   sm = 0  #sm is sum

   for x in lst:

       sm += x

   mean = sm/len(lst)

   deltaG = 75 - mean

   return deltaG

7 0
3 years ago
Which agricultural CTSO has programs for middle-school and high-school students, as well as college students?
Airida [17]
National FFA is the answer to your question my guy.
4 0
3 years ago
Read 2 more answers
What is the output of the following code:
Zielflug [23.3K]

Answer:

Explanation:

print(list1)

['C++', 'JAVA', 'ASP.PHP']

[2:-2]

Gets 2 position(C++) to -2 position(ASP.PHP), JAVA is in the Middle

print(list2)

[]

Gets middle of C++(nothing)

print(list3)

['Python', 'JAVA', 'MySQL']

Get first, jump 3, get first...

'get', 'any', 'any', 'get', 'any', 'any', 'get', ...

7 0
3 years ago
You just got a shipment of 10 network-attached laser printers. You want these printers to always have the same address but you w
love history [14]

Answer:

Configure Reservations

Explanation:

The reason you do this, is because you are getting a permanent IP address assignment.

Hope this helps!

6 0
3 years ago
Other questions:
  • Which of the following is a useful policy to minimize waste and mistakes?
    6·1 answer
  • Write and run a Python program that asks the user for a temperature in Celsius and converts and outputs the temperature in Fahre
    10·1 answer
  • How does LinkedIn differ from other popular social media platforms? What are the similarities?
    6·1 answer
  • Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods
    8·1 answer
  • 2. (8 points) When creating the Academic Database, there were several instances of data
    11·1 answer
  • )In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
    6·1 answer
  • A student registers for a course in a university. Courses may have limited enrollment i.e a student must
    5·1 answer
  • Pls help... : Slide layouts can be changed by _____.
    9·1 answer
  • Please help me asapppp!​
    8·2 answers
  • A user has become compromised as a result of visiting a specific web page, without clicking on any kind of content. What type of
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!