Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This code is posing an issue in that I cannot get it to match the format below a

ID: 3545775 • Letter: T

Question

This code is posing an issue in that I cannot get it to match the format below and stay on the screen. Any assistance would be appreciated.



Write a console program using MS Visual C# 2010 that will meet the following requirements:

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

The program should use StringBuilder and any loop construct that will work to output the string "Bark " and "Meow " ten (10) times with growing columns (1 to 10) as shown below.

The odd columns will display "Bark " and the even columns will display "Meow ".

Each row will be built using StringBuilder.

You should format your output to look exactly like the following:

Bark
Bark Meow
Bark Meow Bark
Bark Meow Bark Meow
Bark Meow Bark Meow Bark
Bark Meow Bark Meow Bark Meow
Bark Meow Bark Meow Bark Meow Bark
Bark Meow Bark Meow Bark Meow Bark Meow
Bark Meow Bark Meow Bark Meow Bark Meow Bark
Bark Meow Bark Meow Bark Meow Bark Meow Bark Meow
Press any key to continue . . .

Explanation / Answer

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace ConsoleApp

{

class Program

{

static void Main(string[] args)

{

StringBuilder sb = new StringBuilder();

for (int i = 1; i <= 10; i++)

{

if (i % 2 == 1)

sb.Append("Bark ");

else

sb.Append("Meow ");

Console.WriteLine(sb.ToString());

}


Console.Read();

}

}

}