When I declare a variable "string x = Console.Read();" the message is shown: "Cannot implicitly convert type 'int' to 'string'".
To test this, I made the console show the value I wrote in the input. I typed 5 in the input but the console showed me 53.
Why is this happening?
thank you in advance
public static void a21() {
System.Console.Write("Deseja ver a sequência até qual termo? ");
int n = Convert.ToInt32(Console.Read());
int count = 0;
int[] vetor = new int[n];
while (count < n)
{
int quadrado = count * count;
vetor[count] = quadrado;
count++;
}
for (var i = 0; i < n; i++)
{
System.Console.WriteLine(vetor[i]);
}
System.Console.WriteLine(n);
}