Hello, I’m working on this task:
Write a program that reads an integer count, for the number of characters to read, from the console. Then, from a new line, the program should read count characters written in one line from the console. Finally, the program should output only the letters from the characters to the console on one line. For example:
>10
>FL45H0b12c
FLHbc
Here is my code:
namespace CharType
{
class OnlyLetters
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
string c = "";
for (int i = 0; i < a; i++)
{
char b = Convert.ToChar(Console.Read());
c = c + b;
}
Console.WriteLine(c);
}
}
}
ok right now I’m focusing on writing the code for reading the n number of char, so
why this code isn’t repeat (i < a) time…