Nested Loops #113 (Da table)

Code

/// Name: Amir Salehi
/// Period: 7
/// Program Name: Multiplication Table
/// File Name:MultiplicationTable.java
/// Date Finished: 5/1/2016

    public class MultiplicationTable
    {
        public static void main( String[] args )
        {
            System.out.println();
            
            int n;
            
            System.out.println( "x | 1      2       3       4       5       6       7       8       9 " );
            System.out.println( "===+=================================================================" );
            
            for ( int y=1; y <= 12; y++ )
            {
                System.out.println();
                System.out.print( y + " | " );
                
                for ( int x=1; x <= 9; x++ )
                {
                    n = x*y;
                    
                    System.out.print( n + "\t" );
                }
            }
            
            System.out.println();
        }
    }  




    

Picture(s) of the output

Assignment 7

Back to Homepage