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
1) Which of the following would you NOT see on a Windows 10 Start menu?
Sati [7]
Task view

I hope this helps you :)
3 0
2 years ago
HELPPPPPPPP
Reika [66]
The answer is visual hierarchy :)
4 0
3 years ago
Read 2 more answers
In python, what is the difference between a dictionary and a set? How are they similar?
yuradex [85]

Answer:

"A set is an unordered collection. A dictionary is an unordered collection of data that stores data in key-value pairs."

Explanation:

Set =>

Collection of non-repetitive elements.

Unordered

Unindexed

No way to change items.

Dictionary =>

Collection of key-value pairs.

Unordered

Indexed

Mutable

4 0
2 years ago
What is a blog that is set up for advertising purposes and used to send website links and other spam? A. splog B. adlog C. qlog
Alex_Xolod [135]

A. Splog. also known as "spam blog"

3 0
3 years ago
Read 2 more answers
Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "
Hatshy [7]

Answer:

Statement:

print("first is "+str(first)+"  second = "+str(second)) # It is a python statement where first and second are variable of any type.

Explanation:

  • The above statement is the print statement that prints the value of first and second variables like in the form of "first is" value of the first variable, then space, then "second = b" and then the value of the second variable.
  • The value for the first and the second variable of any type but it convert it into string form with the help of str() function in the print statement.
  • The string of the print statement can be formed by the help '+' operator which adds the string with the value and the other string in print statement in java and python language.
4 0
3 years ago
Other questions:
  • A(n) ____________ is a program that translates a high-level language program into a separate machine language program.
    7·1 answer
  • Tara referred to various information sources while writing her research paper. How can she acknowledge these sources in her docu
    8·1 answer
  • As Jason walks down the street, a large raven starts squawking at him and flapping its wings. Jason thinks to himself ‘That bird
    6·1 answer
  • When using query by example (qbe) in the data manipulation component of a database management system (dbms), the _____ is used w
    5·1 answer
  • Because collecting the adjustment data requires time, the adjusting entries are often a.estimated and recorded earlier than the
    8·2 answers
  • The first known permanent photograph was called "View from the Window at Le Gras." True False
    9·1 answer
  • 1. Describe how research and development influence design. Cite specific examples of how research and development influence desi
    11·1 answer
  • Name the major types of computer systems from slowest to fastest. ​
    9·1 answer
  • Use the svd() function in matlab to compute a, the rank-1 approximation of a. clearly state what a, is, rounded to 4 decimal pla
    15·1 answer
  • What is the difference between concrete language and abstract language? give an example of each.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!