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
What is the first computer ever made?????
Leviafan [203]
The manchester mark 1
6 0
2 years ago
Read 2 more answers
Using information from the lesson, explain how new technologies change your experience as a consumer.
densk [106]

Technological improvements allow me to have greater access to goods around the world. I can buy instantly and communicate instantly with producers. Technology can also help me to monitor economic trends, both in my country and in my own life. In summary, technology helps to give me more freedom to make economic choices.

On e2020

6 0
3 years ago
Read 2 more answers
What is the primary way to access applications in window 10
Alex787 [66]

Choose Start, type the name of the application, like Word or Excel, in the Search programs and files box. In the search results, click the application to start it. Choose Start > All Programs to see a list of all your applications. You might need to scroll down to see the Microsoft Office group.

8 0
3 years ago
Over time, programming languages have evolved in phases called ________.
Tju [1.3M]
Programming Languages have evolved in phases called generations.  The five generations of computers are : <span>First Generation (1940-1956) Vacuum Tubes. Second Generation (1956-1963) Transistors. Third Generation (1964-1971) Integrated Circuits. Fourth Generation (1971-Present) Microprocessors. <span>Fifth Generation (Present and Beyond) Artificial Intelligence.</span></span>     
6 0
3 years ago
Read 2 more answers
Moving your Sprite top to bottom is moving along the X coordinate?
Marianna [84]
The answer is false
6 0
3 years ago
Other questions:
  • A subclass of Value, LargerValue, is defined with a getValue method that returns twice the value of the parent. Which line is th
    13·1 answer
  • Which ipv6 router message is sent via multicast with a scope of link-local with the expectation that all local routers will iden
    5·1 answer
  • What occurs when you call a method on a reference variable that contains null? Select one: a. An ArrayIndexOutOfBoundsException
    11·1 answer
  • Managing your calendar and emails can be easily accomplished through ___ software
    8·1 answer
  • What development in operating systems happened between the years 1990 and 2000?
    15·1 answer
  • Without entering into the internet cloud or intranet cloud, how many icons in the topology represent endpoint devices (only one
    6·1 answer
  • Which criteria can cuboids/frame selectors be coloured by​
    15·1 answer
  • L00000000000000000000000000000000000000000000000000000000l they b00ty tickled
    6·2 answers
  • What are three sections in a work sheet accounting
    12·1 answer
  • Please help me.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!