Assignemnt #114 Multiplication Table
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: Multiplication Table
///File Name: Mt.java
public class Mt
{
public static void main( String[] args)
{
System.out.println( "x | 1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t" );
System.out.println("==+================================================================================================");
for( int y=1; y<= 12; y++)
{
for( int x=1; x<= 12; x++)
{
if (x==1)
{
if(y<10)
{
int a=(x*y);
System.out.print(" " + y + " | " + a + " \t");
}
else if (y>9)
{
int a=(x*y);
System.out.print(" " + y + "| " + a + " ");
}
}
else
{
int a=(x*y);
System.out.print("" + a + " \t");
}
}
System.out.println();
}
}
}
Picture of Output