1
But my code is going wrong.
namespace Impar_ou_parr
{
class Program
{
static void Main(string[] args)
{
string NumLetras;
Console.WriteLine("Digite uma Palavra: ");
NumLetras = Console.ReadLine();
Console.WriteLine("Sua palavrra tem " + NumLetras.Length + " letras!");
int x;
x = int.Parse(Console.ReadLine());
if (x % 2 == 0)
{
Console.WriteLine("Sua palavra tem um numero par de letras");
}
else
{
Console.WriteLine("Sua palavra tem um numero impar de letras");
}
Console.ReadLine();
}
}
}
What kind of error and where the same is occurring?
– Jeferson Almeida
I don’t understand what the doubt is. Say the mistake, what should happen, because you need to take this
x
.– Maniero
x = Numletras. (Console.Readline()); is giving error n know why
– Genezis
should not be x = int. Parse(Numletters.Length), for x to receive the word size?
– TotallyUncool
x = int.Parse(Numletras.Length), still giving error, I had already tried
– Genezis
What error is appearing?
– TotallyUncool
cannot Convert from 'int' to 'string'
– Genezis
ah, x = Numletras.Length
– TotallyUncool
Lenght already returns an int, no parse needed
– TotallyUncool
@Genezis does not add details of the pargunta in the comments. Edit your question and put the comments there. So that someone, with the same problem, will read, will understand the whole scenario just by the question.
– Thiago Lunardi