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
Ksivusya [100]
3 years ago
8

What is output by the following C# code segment? int temp; temp = 180; while ( temp != 80 ) { if ( temp > 90 ) { Console.Writ

e( "This porridge is too hot! " ); // cool down temp = temp – ( temp > 150 ? 100 : 20 ); } // end if else { if ( temp < 70 ) { Console.Write( "This porridge is too cold! "); // warm up temp = temp + (temp < 50 ? 30 : 20); } // end if } // end else } // end while if ( temp == 80 ) Console.WriteLine( "This porridge is just right!" );
Computers and Technology
2 answers:
tekilochka [14]3 years ago
3 0

Answer:

The output of the code is

This porridge is too hot!

This porridge is just right

Explanation:

First, I'll need to arrange the code properly

int temp;

temp = 180;

while ( temp != 80 ) {

if ( temp > 90 ) {

Console.Write( "This porridge is too hot! " ); // cool down

temp = temp – ( temp > 150 ? 100 : 20 ); } // end if

else {

if ( temp < 70 ) {

Console.Write( "This porridge is too cold! "); // warm up

temp = temp + (temp < 50 ? 30 : 20);

} // end if

} // end else

} // end while

if ( temp == 80 )

Console.WriteLine( "This porridge is just right!" );

At line 2, the value of temp is 180

At line 3, an iterative statement is used to test if temp is not Equal to 80.

The statement is true so the code within the iteration is performed

At line 4, the values of temp is tested again

Is temp greater than 70?

Yes

At this point, the compiler prints "This porridge is too hot! " , Without the quotes

The next line performs arithmetic and assignment operation on temp

First, is temp greater than 150?

Yes

So, the arithmetic operations becomes

temp = 180 - 100 which gives 80

All other statements within the while iteration are then ignored

The compiler then test for the second time if temp is still not equal to 80.

Note that at this point, temp = 80

So, the test is false

All statements within the while iteration will then be ignored.

Program execution then moves to line 14.

Is temp = 80?

Yes

The compiler prints "This porridge is just right!" without the quotes.

Salsk061 [2.6K]3 years ago
3 0

Answer and Explanation:

The output by the following C# code segment is (b): This porridge is too hot! This porridge is just right!

Explanation: first of all in this program declare a temp variable and assign a value 180  after that condition in the while-loop statement and if statement under while-loop will

check first time it will true and console report showing result (This porridge is too hot!) and change the temp value from next line now temp value is set to 80 now first iteration of loop is completed and in next iteration, while loop condition is check now its condition is false so skip the loop and go to if state where check temp = 80 and print console value  (This porridge is just right!)

You might be interested in
How should a common data source, like social media comments, be categorized
Masja [62]

Answer:

unstructured data

Explanation:

Sources that are likely to give you unstructured data might be: Social media posts

4 0
2 years ago
How to see the range of values of vty lines?
PSYCHO15rus [73]

Answer:

To get the range of very lines in a switch or a router, in the global mode, type " line very" and the question mark after the space. It displays the ranges of valid very lines in the device.

Explanation:

Routers and switches are intermediate components of a computer network. They are used to connect various nodes and networks. For a remote connection, they use the virtual interface called vty to connect to computers for management purposes. These vty lines allows for SSH and telnet access from workstations and the range of very lines are predetermined and limited and varies for all switches and routers.

7 0
4 years ago
Which of the following is not a common operating system? A) Apple B) Linux C) Unix D) Windows Vista​
sleet_krkn [62]

Answer:

A) Apple

Explanation:

An operating system is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system acts as an interface or intermediary between the computer end user and the hardware portion of the computer system (computer hardware) in the processing and execution of instructions.

Some examples of an operating system on computers are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.

Apple is not a common operating system.

However, MacOS is an operating system that is designed and developed by an American multinational technology company called Apple Inc.

5 0
3 years ago
Visual Basic: What are arrays, please give an example code.
Drupady [299]

Answer:

An array is a collection of similar types of data. For example, if we want to store the names of 100 people then we can create an array of the string type that can store 100 names. String[] array = new String[100];

<h2>HOPE ITS HELPS YOU</h2>

4 0
2 years ago
Read 2 more answers
Who go to Tennessee Connection Academy And If yall Do plz comment down below.
zalisa [80]

Answer:

it a or d

Explanation:

7 0
3 years ago
Other questions:
  • 642<br> +277<br> What does 642+277
    7·1 answer
  • A machine that is used to print newspaper is a
    12·2 answers
  • A network administrator manages a network with 75 servers. At least twenty of those servers are approaching end of life but the
    8·1 answer
  • Guys please join this link... I want friends...
    7·2 answers
  • Which of the following are parts of the Physical Layer?
    9·1 answer
  • For things like school, you should have a more serious:
    11·1 answer
  • Which search phrase is the most effective to find out about the most popular pizza chains worldwide in 2019?
    14·1 answer
  • Write the following program: Use struct data type to store information about courses. Every course is characterized by the follo
    6·1 answer
  • Create a python program that display this
    9·1 answer
  • What describes the current cloud landscape for business?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!