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
Select the correct answer.
VARVARA [1.3K]

Answer:

D

Explanation:

It is D

Select the correct answer.

Identify the correct CSS syntax to link an external style sheet.

6 0
3 years ago
Write a program that produces this output:
AveGali [126]

Answer:

void printC()  

{  

   int i, j;  

   for (i = 0; i < 4; i++) //i indicate row number. Here we have 5 rows

       {  

         printf("C"); //print C for every row  

         for (j = 0; j < 6; j++) //j indicate column number. Here we have 7 Rows

         {  

           if (i == 0 || i == 4) //For first and last row  

               printf("C"); //print 'CCCCCCC'

          else if (i = 1|| i= 3) //for Second forth row  

                printf("C        +      +"); //print 'C    +    +'

          else if (i = 2) For second row  

                printf("C       +++++"); //print 'C +++++'

           else

               continue; //to jump to next iteration

         }  

         printf("\n"); // print in next line

}  

}

4 0
3 years ago
_____ computing refers to a computing environment that is always present, can feel our surroundings, and-based on who we are, wh
tensa zangetsu [6.8K]

Answer:

b. Contextual computing

Explanation:

Contextual computing -

In this method of computing , the hardware and the software collect and examine the data all by itself from the near by areas in order to make it presentable , is known as the method of contextual computing .

It is also known as the context - aware computing .

Hence , from the given information of the question , the correct term from the given options is b. Contextual computing .

4 0
4 years ago
How much does it cost to go to csun school
wolverine [178]
I believe you will find all your answers here,

http://www.csun.edu/prospectivestudents/cost-attendance
6 0
4 years ago
Question 18
beks73 [17]

Answer:

None

Explanation:

Logical operators:

'and' indicates that the statement is true if both conditions are true.

'or' indicates that the statement is true if one or both conditions are true.

Given that a = 1 and b = 10:

The first statement is false (1×10 <= 1 is false, 1 >= 10 is also false)

The second statement is false (1>10 is false, a does not equal b)

The third statement is false (a does not equal b)

None of these statements are true.

Hope this helps :)

8 0
3 years ago
Other questions:
  • Write a function named print_backward that accepts a String as its parameter and prints the characters in the opposite order. Fo
    12·1 answer
  • Declare a character variable letterStart. Write a statement to read a letter from the user into letterStart, followed by stateme
    10·1 answer
  • HTML code must be enclosed in the _______ (angle brackets) so the browser can tell the difference between code and content you w
    6·2 answers
  • What is the correct html element for inserting a line break?
    12·1 answer
  • Web 2.0 has led to a shift just from consuming content towards what
    6·1 answer
  • . The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8
    12·1 answer
  • Write a definition in your own words for Raster Graphic. Do not copy and paste please.
    12·1 answer
  • You develop an app, and you don’t want anyone to resell it or modify it. This is an example of: A
    5·1 answer
  • A type of user interface that features on- screen objects, such a menus and icons, manipulated by a mouse.
    7·1 answer
  • What construction work is the tender for​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!