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]
4 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]4 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
According to the SANS Institute, a __________ is typically a document that outlines specific requirements or rules that must be
nata0808 [166]
That’s should be in the quizlet I think..
7 0
3 years ago
Write the corresponding Python assignment statements:
Alenkinab [10]

a)

length = 10

breadth = 20

b)

sum = 15

c)

fullname = "{} {} {}".format(first, middle, last)

8 0
3 years ago
A tornado may be approaching if you observe which of the following?
musickatia [10]
I would go with a funnel cloud on this one. It is the most common sign although it does not guarantee a tornado. Most tornadoes that reach the ground do expand from funnel clouds, but a condensation funnel cloud formation is not absolutely necessary for a tornado to form.
5 0
3 years ago
Describe the three criteria you should use to determine if an online media source should be included in your paper or presentati
VikaD [51]
<span>To use an online resource, it should be relevant to the topic. It should be credible, coming from an expert on the topic. Finally, it should be valid, coming from a source that is based in truth or fact.</span>
7 0
3 years ago
Read 2 more answers
Which Internet connection can have speeds around 1 Gbps?<br> Cable<br> DSL<br> Fiber<br> Satellite
Alexus [3.1K]
<h2>Answer:</h2>

<u>Fiber</u> Internet connection has speeds around 1 Gbps.

<h2></h2><h2>Explanation:</h2>

Fiber Internet connection is the modern way of transmitting and receiving data. As obvious from the name Optical Fiber consists of thin fibers that are extremely thin (as a human hair). They transmit data with the beam of light that make this transmission speedy as well as reliable. Therefore they provide  the download speed ranging from 25 Mbps to 1 Gbps.

Fiber Internet connection is considered best for the small businesses as it provides high bandwidth for transmission.  The best part of this connection is that it is made of glass and plastic that  do not conduct heat or electricity that means the fiber is safe from the damages as well.

<h3>I hope it will help you! </h3>
5 0
4 years ago
Other questions:
  • True or False? When shooting OTS shots of two actors / subjects speaking to each other, it is best to place the camera(s) over t
    10·1 answer
  • How has the development of personal computer hardware and software reversed some of the trends brought on by the industrial revo
    15·1 answer
  • How does scarcity affect what gets produced
    5·1 answer
  • While designing your network's VLAN topology, your team has decided to use a centrally managed DHCP server rather than creating
    8·1 answer
  • A ____ is used to perform a forward-only (sequential) access of the data in the data source while a ____ is used to populate a d
    11·1 answer
  • Write a python function c that converts bitstring array back to an integer numpy array
    5·1 answer
  • Write a program that will sort an array of data using the following guidelines - DO NOT USE VECTORS, COLLECTIONS, SETS or any ot
    10·1 answer
  • Please describe the role of games in modern society!
    5·2 answers
  • How to transfer bookmarks from one computer to another.
    13·1 answer
  • When developing an output control system, it is important to implement output standards that: (Choose all that apply.)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!