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
Strike441 [17]
3 years ago
5

Given the integer variables x and y, write a fragment of code that assigns the larger of x and y to another integer variable max

.
Computers and Technology
1 answer:
Sidana [21]3 years ago
7 0

Answer:

if ( x > y ) {

    max = x;

}

else {

    max = y;

}

Explanation:

Assumptions:

(i) Variables x, y and max have been defined.

(ii) Since the question does not specify what to do if x and y are equal, I have assumed no such case exists. i.e x and y are never equal.

PS : The code has been written in Java.

According to the question, the larger of variables <em>x</em> and <em>y</em> is assigned to another variable, <em>max.</em>

To check which of x and y is greater, we could use an <em>if...else</em> statement like so;

if ( x > y ) {      // check if x is greater than y

  max = x;      // if yes, assign the value of x to max

}

else {             // then y is greater

 max = y;      // assign the value of y to max

}

You might be interested in
You can pin applications to which two areas?
mrs_skeptik [129]

Answer:

A and C.

Explanation:

The taskbar and the Start are both shortcuts to use when opening applications. The taskbar is at the bottom of your computer or pc. And the start can be opened by pressing the windows key or clicking on windows at the bottom right (Windows only.)

Hope that helps!

5 0
3 years ago
It is a JavaScript property used to call a function after a specified time, in milliseconds​
AVprozaik [17]

Answer:

setTimeout is a native JavaScript function (although it can be used with a library such as jQuery, as we'll see later on), which calls a function or executes a code snippet after a specified delay (in milliseconds).

8 0
3 years ago
Read 2 more answers
What is impact of Internet<br> in our lives
NeTakaya

Answer:

The Internet has changed business, education, government, healthcare, and even the ways in which we interact with our loved ones—it has become one of the key drivers of social evolution. The changes in social communication are of particular significance.

7 0
3 years ago
What is your F O R T N I T E name
kolbaska11 [484]

Answer:

don't have name, but would be something cool.

Explanation:

poor, have a splendid day.

6 0
2 years ago
Read 2 more answers
What’s the answer for this
attashe74 [19]
I believe the answer is B<span />
3 0
3 years ago
Other questions:
  • What is the program that searches through data bases?
    10·1 answer
  • What is the Documenter?
    10·1 answer
  • A(n) _____ is a telephone facility that manages incoming calls, handling them based on the number called and an associated datab
    5·1 answer
  • What type of engineer is interested in designing, developing, and building different machines, devices, and tools? A.aerospace
    8·2 answers
  • There are many apps that help find you cheaper gas. If the cost of a gallon of regular gas is $3 at one station and $3.50 at ano
    15·1 answer
  • Listening to music on giggl, join!<br><br> link will be in comments, copy and paste
    9·2 answers
  • What feature allows you to access previous copies of a document on OneDrive?
    15·2 answers
  • A website for a certain political party or candidate is likely to have unbiased
    6·1 answer
  • What are price comparison websites?
    6·1 answer
  • Does watching Beastars make me a furry? ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!