User753101303 posted
Hi,
This is homework? You could try :
using System;
namespace ConsoleDemo
{
class Program
{
static void Main(string[] args)
{
var str = new string[] { "a", "b\n", "c", "d" };
for (var i = 0;i<str.Length;i++) // iterate over each array index
{
if (!str[i].EndsWith("\n")) // Check if the string enfs with \n
{
str[i] += "\n"; // append extra string if not
}
Console.Write(str[i]); // Not WriteLine but shown on a separate line on the console
}
Console.WriteLine("End"); // To check \n was appended to the last element
}
}
}