if (vocal.Length <= 1) { int contador = 0; for (int i = 0; i < frase.Length; i++) { if (frase[i] == vocal[0]) { contador++; } } Console.WriteLine(contador + " veces se repite la vocal " + vocal + " en la frase " + frase); } else { Console.WriteLine("Error de ingreso"); } Console.WriteLine("¿Desea ingresar una frase? s/n"); respuesta = Console.ReadLine();
The for loop that is inside the if statement, is going to iterate through the phrase string and will count the times it finds the vowel in the string.