❔ I have implemented a project and need to solve these errors
{
int antalOrd, summa;
List<string> ordLista = new List<string>();
Console.WriteLine("Välkommen till Räknaren!");
Console.Write("Hur många ord vill su skriva in? Antal: ");
Int32.TryParse(Console.ReadLine(), out antalOrd);
for (int i = 0; i < antalOrd; i++)
{
Console.WriteLine("Skriv in ord nr." + (i + 1) + ": ");
ordLista.Add(Console.ReadLine());
}
if (ordLista.Count > 0)
int summa = RäknaBokstäver(ordLista);
Console.WriteLine("Alla ord du har skrivit har totalt " + summa + " symboler.");
else
Console.WriteLine("Du har valt att inte skriva några ord.");
Console.ReadLine();
}
static void RäknaBokstäver(List<string> mottagenLista)
{
summa = 0;
for (int i = 0; i < mottagenLista.Count; i++)
{
summa += mottagenLista[i].Length;
return summa;
}
}{
int antalOrd, summa;
List<string> ordLista = new List<string>();
Console.WriteLine("Välkommen till Räknaren!");
Console.Write("Hur många ord vill su skriva in? Antal: ");
Int32.TryParse(Console.ReadLine(), out antalOrd);
for (int i = 0; i < antalOrd; i++)
{
Console.WriteLine("Skriv in ord nr." + (i + 1) + ": ");
ordLista.Add(Console.ReadLine());
}
if (ordLista.Count > 0)
int summa = RäknaBokstäver(ordLista);
Console.WriteLine("Alla ord du har skrivit har totalt " + summa + " symboler.");
else
Console.WriteLine("Du har valt att inte skriva några ord.");
Console.ReadLine();
}
static void RäknaBokstäver(List<string> mottagenLista)
{
summa = 0;
for (int i = 0; i < mottagenLista.Count; i++)
{
summa += mottagenLista[i].Length;
return summa;
}
}