What must be changed in the segment of code in Exercise #22 to cause all of the
output to be displayed on one line?
The given Exercise #22 is
Line 1 // Example program – displaying output.
Line 2 using System;
Line 3 namespace ExerciseI
Line 4 {
Line 5 class Problem2
Line 6 {
Line 7 static void Main( )
Line 8 {
Line 9 Console.Write("Go ");
Line 10 Console.Write("Laugh ");
Line 11 Console.WriteLine("Out Loud");
Line 12 Console.Write("Think ");
Line 13 Console.Write("Happy");
Line 14 }
Line 15 }
Line 16 }
Change has to done is
Line 11 has to canged from Console.WriteLine("Out Loud"); to Console.Write("Out Loud ");
*Changed program is
using System;
namespace ExerciseI
{
class Problem2
{
static void Main()
{
Console.Write("Go ");
Console.Write("Laugh ");
Console.Write("Out Loud ");
Console.Write("Think ");
Console.Write("Happy");
}
}
}
Output :
Go Laugh Out Loud Think HappyPress any key to continue . . .