I was working on some code to produce a 10 x 10 multiplication table with equal tabbing and spacing between rows. I can't seem to get more than one column on my table though. I did some other research but wasn't able to find a helpful answer. Any help is appreciated.

public class MultiplicationTable
{

    public static void main (String [] args)
    {

    //declare variables

    int x = 1;
    int y = 1;


    //outer loop

        for (x = 1; x <=10; x++)
        { // open the x loop

        System.out.println(x + "\n");

            for (y = 1; y <=10; y++)
            { // open the y loop

            System.out.println(x*y+"\n");


            }

            System.out.println("\n");
        }




    }
}

Recommended Answers

All 3 Replies

Remember: each loop has to print a loop of 10 (horizontally -- no line-feed)

The print method is just like println, except it doesn't go onto the next line afterwards....

The print method is just like println, except it doesn't go onto the next line afterwards....

...or printf

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.