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 Search Network text ad component provides up to three fields of 30 characters each?"
Alex_Xolod [135]

Answer:

The headline component is the correct answer.

Explanation:

The headline component provides their user a better experience to modify the text or fonts of the heading and simple text with that links which is inline to those pages that displaying the topics, articles and also the discussions. This is also used for the particular search network text and also for the google ads components. So, that's why the following option is correct.

7 0
3 years ago
Choose all items that represent HTML characteristics.
hram777 [196]

Answer:

A,C,D,E are the answers at least on the test i took

Explanation:

3 0
3 years ago
Read 2 more answers
A _____ model is one that is automatically adjusted based on changing relationships among variables.
BabaBlast [244]

Answer: dynamically modified model

Explanation:

7 0
1 year ago
Write a program FindDuplicate.java that reads n integer arguments from the command line into an integer array of length n, where
kozerog [31]

Answer:

  1. public class FindDuplicate{
  2.    public static void main(String[] args) {
  3.        Scanner input = new Scanner(System.in);
  4.        int n = 5;
  5.        int arr[] = new int[n];
  6.        for(int i=0; i < arr.length; i++){
  7.            int inputNum = input.nextInt();
  8.            if(inputNum >=1 && inputNum <=n) {
  9.                arr[i] = inputNum;
  10.            }
  11.        }
  12.        for(int j =0; j < arr.length; j++){
  13.            for(int k = 0; k < arr.length; k++){
  14.                if(j == k){
  15.                    continue;
  16.                }else{
  17.                    if(arr[j] == arr[k]){
  18.                        System.out.println("True");
  19.                        return;
  20.                    }
  21.                }
  22.            }
  23.        }
  24.        System.out.println("False");
  25.    }
  26. }

Explanation:

Firstly, create a Scanner object to get user input (Line 4).

Next, create an array with n-size (Line 7) and then create a for-loop to get user repeatedly enter an integer and assign the input value to the array (Line 9 - 14).

Next, create a double layer for-loop to check the each element in the array against the other elements to see if there is any duplication detected and display "True" (Line 21 - 22). If duplication is found the program will display True and terminate the whole program using return (Line 23). The condition set in Line 18 is to ensure the comparison is not between the same element.

If all the elements in the array are unique the if block (Line 21 - 23) won't run and it will proceed to Line 28 to display message "False".

7 0
2 years ago
The option to publish a file as a blog post is located in the____options on the File tab.
shtirl [24]
The answer is #2: Share
3 0
2 years ago
Other questions:
  • Jason is creating a web page for his school's basketball team. He just finished creating his storyboard. Which tool should he us
    6·2 answers
  • To insert a column without using commands in any tabs, a user can _____ -click and then click insert column.
    6·2 answers
  • What keyword do we use when instantiating an object _________________
    15·1 answer
  • An automated service that consolidates and distributes information from newsgroups, blogs, forums and news websites is called
    11·1 answer
  • Write a method printshampoolnstructions0, with int parameter numCycles, and void return type. If numCycles is less than 1, print
    8·1 answer
  • The first row in a table is referred to as the _____ row and the last row is considered the _____ row.
    9·1 answer
  • Which sentence is correctly punctuated? WILL GIVE YU MONEY GIVE ME YOUR CASH APP PLS
    12·2 answers
  • What are some things all boomers say.
    12·2 answers
  • Fictional Corp has a data center that runs multiple internal applications. However, they want to migrate their email to a cloud
    9·1 answer
  • To find information on a network use a ____
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!