I've been working on a program that generates 100 random, 3-digit numbers and displays the sum of all 100 numbers. For every 10th number displayed, I'm trying to add a message next to the number stating " is the 10th number." So far, I've only been able to display said message BELOW every 10th number, instead of next to it. I've tried string.concat, StringBuilder, and a simple WriteLine statement, but every time, the message is still shown below the number. Any thoughts?

static void Main(string[] args)
            Random bill = new Random();//Declaring my random variable
            int count = 0;//initializing the number Sum
            int i = 1;//initializing the number total

            for (i = 1; i <= 100; i++)//Looping through 100 Random numbers
                int num = bill.Next(100, 1000);//Making sure Random numbers are three digits under 1000

                count += num;//Storing the Sum

                if ((i % 10) == 0)//Setting up message for every 10th number displayed

                    Console.WriteLine("is the 10th number.");

            Console.WriteLine("The Grand Total of all numbers is:{0} ", count);//Displaying Sum of all 100 numbers

Nevermind, I discovered that I could use an "if/else" statement instead of using just one "if" statement for the message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.