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]
4 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]4 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]4 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
Who developed the engineering design process.
mamaluj [8]

Answer:

IDK but i know what it is

Explanation:

The engineering design process is a series of steps that guides engineering teams as we solve problems. The design process is iterative, meaning that we repeat the steps as many times as needed, making improvements along the way as we learn from failure and uncover new design possibilities to arrive at great solutions.

8 0
3 years ago
When spark plug cables aren't far enough apart, premature firing of adjacent spark plugs can happen. this is known as?
e-lub [12.9K]
Misfiring seems to be a blanket term for spark plug inefficiencies and errors due to wrong gap configuration. Because of the small gap, the time <span>of the spark has less travel distance, it does not remain hot enough to ignite the air-fuel mixture that is needed to run the engine. </span>
7 0
3 years ago
your brother has made a battery operated torch by using 2 cells &amp; has come to ask you how he may make the torch more powerfu
torisob [31]

Answer: Add more cells in series.

Explanation:

Adding more cells in series will add voltage which will increase the power.

5 0
4 years ago
A _____ describes the actual processes of entering, verifying, and storing data; the physical layout of data files and sorting p
DaniilM [7]

Answer: c)  Physical design

Explanation:

Physical design in terms of computation is defined as the model through which internal entities as well as external entities of system is depicted and displayed.The motion of the service and data flow taking place , storage of information, physical structure ,data conversion etc is described through physical design.

  • Other options are incorrect because qualitative design gives evaluation about quality layout. Quantitative design is based on quantity to display the layout.
  • Logical design is designing of the system through applying logic and order to arrange the data to establish relationship between system components.
  • Thus, the correct option is option(c).

5 0
4 years ago
A friend of mine had a samsung j2 phone and someone with a iphone placed something in her phone she thought was malware in her p
natta225 [31]

Answer:

um I'm confused

Explanation:

3 0
2 years ago
Other questions:
  • A major weakness of a lot of file processing systems is that ____.
    10·1 answer
  • Which of the following best describes the protocols used on the Internet?
    9·1 answer
  • Which of the following is a typical concern for developers while using prototypes?
    6·2 answers
  • Create a script that creates a new local variable.<br>• Name: BETTY<br>Value: Holberton<br>​
    6·1 answer
  • What was the first stored prograam electronic digital computer
    11·2 answers
  • With a DUI charge on a driver’s record ______________.
    10·1 answer
  • __________ contain(s) remnants of word processing documents, e-mails, Internet browsing activity, database entries, and almost a
    9·1 answer
  • Which of the following is an example of a database?
    10·2 answers
  • Hey guys im just curious.... whats ur favorite number
    6·2 answers
  • Which of the following describes how modern operating systems function?: A
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!