0

I have this block of code, and I need it to work with more than just 3 letter words. I tried adding another loop and a variable but I can't seem to get this right. Can somebody help?

string word = "dot";
int k = 0;
for(int i = 0; i < 3; i++)
{
    for(int j = 0; j < 3; j++)
    {
        if (i == j) continue;
        k = 3 - i - j;
        Console.WriteLine(word[i]);
        Console.WriteLine(word[j]);
        Console.WriteLine(word[k]);
        Console.WriteLine();
    }
}
SomeBody
  • 6,564
  • 2
  • 15
  • 30
shade999
  • 79
  • 6

0 Answers0