List<string> words = new List<string>();
string input;
do
{
Console.Write("Woord? ");
input = Console.ReadLine();
words.Add(input);
} while (!string.IsNullOrWhiteSpace(input));
string longWord = words[0];
string shortWord = words[0];
foreach (string word in words)
{
if (word.Length < shortWord.Length)
{
shortWord = word;
}
else if (word.Length > longWord.Length)
{
longWord = word;
}
}
int indexShortWord = words.IndexOf(shortWord);
int indexLongWord = words.IndexOf(longWord);
int addingUp = indexShortWord + indexLongWord;
Console.WriteLine($"Het langste woord is {longWord}");
Console.WriteLine($"Het kortste woord is {shortWord}");
Console.WriteLine($"De som van de posities is {addingUp}");
Console.ReadLine();
List<string> words = new List<string>();
string input;
do
{
Console.Write("Woord? ");
input = Console.ReadLine();
words.Add(input);
} while (!string.IsNullOrWhiteSpace(input));
string longWord = words[0];
string shortWord = words[0];
foreach (string word in words)
{
if (word.Length < shortWord.Length)
{
shortWord = word;
}
else if (word.Length > longWord.Length)
{
longWord = word;
}
}
int indexShortWord = words.IndexOf(shortWord);
int indexLongWord = words.IndexOf(longWord);
int addingUp = indexShortWord + indexLongWord;
Console.WriteLine($"Het langste woord is {longWord}");
Console.WriteLine($"Het kortste woord is {shortWord}");
Console.WriteLine($"De som van de posities is {addingUp}");
Console.ReadLine();