9
Answers

Loops problem please help!

Prime b

Prime b

12y
2k
1
The problem

Write a console-based application that displays a
multiplication table of the product of every integer from
1 through 10 multiplied by every integer from 1 through
10.

What I have done so far

            double firstNumberBottom = 1;
            double increment;
            double something;


            const double firstNumberTop = 1;
            const double maxNumberTop = 10;
            const double numberIncrement = 1;
            const double maxNumberBot = 10;
            const double maxNumberincrement = 1;

            Console.WriteLine("  Number");
            for (increment = firstNumberTop; increment <= maxNumberTop; increment += numberIncrement);
            Console.WriteLine("{0, 8}", increment.ToString("F"));
            Console.WriteLine();
            Console.WriteLine
            ("-------------------------------------------------");
            increment = firstNumberTop;
            while (firstNumberTop <= maxNumberBot)
            {
                Console.WriteLine("{0, 8}", firstNumberTop.ToString("C"));
                while (increment <= maxNumberTop)
                {
                    something = firstNumberTop * increment;
                    Console.Write("{0, 8}", something.ToString("F"));
                    increment += 1;
                }
                firstNumberBottom += maxNumberincrement;
                increment = firstNumberBottom;
                Console.WriteLine();
            }

It doesnt work.....

It should look something like that I am guessing
   1 2 3 4 5 6  7 8 9 10
1
2
3
4
5
6
7
8
9
10

Answers (9)