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
Five advantages of Internet​
Novosadov [1.4K]

Answer:

Information, knowledge, and learning.

Selling and making money.

Banking, bills, and shopping.

Donations and funding

Entertainment.

Explanation:

I hope this helps! ^^

☁️☁️☁️☁️☁️☁️☁️

7 0
3 years ago
Read 2 more answers
Is the process of modifying something to make it fit certain criteria.
alexandr402 [8]

Answer:

Design Process

8 0
3 years ago
The salespeople at hyperactive media sales all use laptop computers so they can have easy access to important data on the road.
laiz [17]

Answer:

By backing up the important information from the laptop computers to OneDrive, if a hard drive failure is to occur, assuming the salespeople have internet, they may access OneDrive and download any and all applicable data, resolving the issue.

6 0
3 years ago
while investigating the settings on your SOHO router, you find two IP address reported on the devices's routing table, which is
DochEvi [55]

Answer:

From the two IP addresses, 192.168.2.1 can be listed as the default gateway in local network devices.

The reason is that we are allocated with the ranges that are reserved for the local networks by RFC 1918.

These ranges are given as follows:

  • For (10/8 prefix)  

                            10.0.0.0 - 10.255.255.255

  • (172.16/12 prefix)

                            172.16.0.0 - 172.31.255.255

  • (192.168/16 prefix)

                            192.168.0.0 - 192.168.255.255

Moreover the default gateway for a device can also be known by the commands ipconfig or  ipconfig/all on the command prompt.

<h3>I hope it will help you!</h3>
7 0
3 years ago
Please tell fast plzzzzzzzzzz​
Svetlanka [38]

Answer:

<!DOCTYPE html>

the declaration ye

Explanation:

probably it ye

3 0
3 years ago
Other questions:
  • What software that allow for one-click performance profiles for msi video card??
    5·1 answer
  • ​A(n) ____ will hold an online auction buyer’s payment until he or she is satisfied that the item bought matches the seller’s de
    13·1 answer
  • Explain each of the three important concepts behind the Federal Networking Council's definition of the term Internet. Explain ho
    8·1 answer
  • The Linux operating system was created by which software engineer?
    15·1 answer
  • Create a function called "strip_r_o" that takes in a STRING and strips all the Rs and Os from the string. Also use a FOR loop in
    7·1 answer
  • Meet.go ogle.etj-dovn-kds​
    14·1 answer
  • How do I find a back door password on my computer?
    12·1 answer
  • True false.
    10·2 answers
  • You defined a class and saved it as shoe.py.
    5·2 answers
  • Match the feature to its function.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!