Right now i and j will both be on the different line when i execute it. How can I get the answers of i and j on the same line?

namespace Nested_While_Loop
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 1;
            while (i < 10)
            {
                Console.WriteLine("i value: {0}", i);
                i++;
                int j = 1;
                while (j < 10)
                {
                    Console.WriteLine("j value: {0}", j);
                    j++;
                }
            }
            Console.WriteLine("Press Enter Key to Exit..");
            Console.ReadLine();

        }
    }
}

This is a simpleNested while loop. How can I write Console.WriteLine(" i :{0},j : {0}", i, j); I am getting many errors.



Read more here: https://stackoverflow.com/questions/64889718/right-now-i-and-j-will-both-be-on-the-different-line-when-i-execute-it-how-can

Content Attribution

This content was originally published by EHSAN NADEEM at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: