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
Semenov [28]
3 years ago
9

Using a conditional expression, write a statement that increments num_users if update_direction is 3, otherwise decrements num_u

sers. Sample output with inputs: 8 3 New value is: 9
Engineering
1 answer:
yuradex [85]3 years ago
6 0

Answer:

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

Explanation:

A. Using the regular if..else statement, the response to the question would be like so;

if (update_direction == 3) {

  ++num_users;  // this will increment num_users by 1

}

else {

 -- num_users;    //this will decrement num_users by 1

}

Note: A conditional expression has the following format;

<em>testcondition ? true : false;</em>

where

a. <em>testcondition </em>is the condition to be tested for. In this case, if update_direction is 3 (update_direction == 3).

b. <em>true </em>is the statement to be executed if the <em>testcondition</em> is true.

c. false is the statement to be executed it the <em>testcondition</em> is false.

B. Converting the above code snippet (the if..else statement in A above) into a conditional expression statement we have;

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

<em>Hope this helps!</em>

You might be interested in
If you are a mechanical engineer answer these questions:
Natasha_Volkova [10]

Answer:

1. Yes, they are all necessary.

2. Both written and verbal communication skills are of the utmost importance in business, especially in engineering. Communication skills boost you or your teams' performance because they provide clear information and expectations to help manage and deliver excellent work.

3 0
3 years ago
If the car passes point A with a speed of 20 m&gt;s and begins to increase its speed at a constant rate of at = 0.5 m&gt;s 2 , d
sattari [20]

Answer:

a = 1.68m/S^{2}

Explanation:

Please kindly find the attached file for explanations

3 0
3 years ago
John wants to construct a device using quartz crystal, Which device can he construct?
tatiyna

Answer: Option D, piezoelectric pressure guage

Explanation: Quartz crystal possess a very useful quality in science as they can generate small charges when pressure is applied to them or when they are hit. This property can be harnessed to construct a piezoelectric pressure gauge which would be used to measure and indicate changes in pressure, the quartz crystal releases little voltage each time there is an applied pressure . This device would be able to sense changes in pressure as there would voltage proportional to the applied pressure.

4 0
3 years ago
Read 2 more answers
Consider a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
nekit [7.7K]

Answer:

98°C

Explanation:

Total surface area of cylindrical fin = πr² + 2πrl , r = 0.015m; l= 0.1m; π =22/7

22/7*(0.015)² + 22/7*0.015*0.1 = 7.07 X 10∧-4 + 47.1 X 10∧-4 = (54.17 X 10∧-4)m²

Temperature change, t = (50 - 25)°C = 25°C = 298K

Hence, Temperature =  150 X (54.17 X 10∧-4) X 298/123 = 242.14/124 = 2.00K =

∴ Temperature change = 2.00K

But temperature, T= (373 - 2)K = 371 K

In °C = (371 - 273)K = 98°C         

7 0
3 years ago
Why the inviscid, incompressible, and irrotational fields are governed by Laplace's equation?
creativ13 [48]

Answer: Laplace equation provides a linear solution and helps in obtaining other solutions by being added to various solution of a particular equation as well.

Inviscid , incompressible and irrotational field have and basic solution ans so they can be governed by the Laplace equation to obtain a interesting and non-common solution .The analysis of such solution in a flow of Laplace equation is termed as potential flow.

6 0
3 years ago
Other questions:
  • I have a plot plan with an angle of 35 degrees on the main lot, how will this affect the construction of the basement
    9·1 answer
  • In a simple ideal Rankine cycle, water is used as the working fluid. The cycle operates with pressures of 2000 psi in the boiler
    7·1 answer
  • Which of the following is NOT true concerning the color of minerals? A. Some minerals have a consistent color, but many have a r
    13·1 answer
  • I need solution for this question ​
    10·1 answer
  • A long corridor has a single light bulb and two doors with light switch at each door.
    15·1 answer
  • A right triangle has a base of 12 inches and a height of 30 inches, what is the centroid of the triangle?​
    5·1 answer
  • Technician A says that a way to prevent galvanic corrosion is to duplicate the original installation method. Technician B says t
    12·1 answer
  • Which organisms are consumers in this food chain? List all that apply. *
    5·1 answer
  • An ideal gas is contained in a closed assembly with an initial pressure and temperature of
    14·1 answer
  • Aqueous cleaners are ________ parts cleaning agents.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!