My output is a string of integers, displayed consecutively on the same line. Preferably using backslash n, how can I make them be displayed, each on a new line? This is what I have this far:
string even = "";
while (true)
{
string inputData = Console.ReadLine();
if (inputData.Equals("x", StringComparison.OrdinalIgnoreCase))
{
break;
}
for (int i = 0; i < inputData.Length; i++)
{
if (inputData[i] % 2 == 0)
{
even +=inputData[i];
}
}
}
foreach (var e in even)
Console.WriteLine(e);
bool something = string.IsNullOrEmpty(even);
if( something == true)
{
Console.WriteLine("N/A");
}
Console.ReadLine();
So, string even, that contains all the even numbers from input should be seen on the console on different lines. Any help would be appreciated!