What is output by the following C# code segment
Int temp = 180;
While (temp != 80)
{
If (temp > 90)
{
Console.Write("This porridge is too hot! ") ;
// cool down
Temp = temp - (temp > 150
100 : 20) ;
}
Else
{
If (temp < 70)
{
Console.Write("This porridge is too cold! ") ;
// warm up
Temp = temp + (temp < 50
30 : 20) ;
}
}
}
If (temp == 80)
{
Console.WriteLine("This porridge is just right!") ;
}
A) This porridge is too cold! This porridge is just right!
B) This porridge is too hot! This porridge is just right!
C) This porridge is just right!
D) None of the above.
Correct Answer:
Verified
Q38: Which of the following is not included
Q39: The C# compiler always associates an else
Q40: During the 1960s,it became clear that the
Q41: Counter-controlled repetition is also known as:
A) definite
Q42: It is known as when the number
Q44: How many times is the body of
Q45: Variables that store totals should generally be
Q46: Repetition in which the number of iterations
Q47: A can be used in repetition structures
Q48: Which of the following is not necessarily
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents