• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Program for Multiplication of tables  RSS feed

 
Brijesh Shah
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*Program to print out multiplication tables from 9 to 17*/
class MultiplicationTablesfor
{
public static void main(String[] args)
{
for(int i=9;i<=17;i++)
{
for(int j=1;j<=10;j++)
{
System.out.println(""+(i*j)+"");
}
System.out.println("");
}
}
}
I want to format the above mathemaatical tables in horizontal rows and not one belo another.
Could you pls help me out in this.
Thanks!!!
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easy. You just need to find a few additional methods.

Look up System.out.println(); (no arguments passed).
Look up System.out.printf(somethingOrOther), and System.out.print(somethingElse), and the formatting options (there are hundreds of them), in the API; look for the Formatter class and make sure you use the first one that appears (java.util.Formatter) not the second one (java.util.logging.Formatter).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!