Public feed #726181

Miscellany

public text v1 · immutable
Raw Edit
·published 2007-10-04 22:57 UTC
rendered paste body
//////////////////////////////////////////////////////////////////////////////////
// ICS 3M1 - Mrs. Shanks
// Patrick Paskaris
// September 30, 2007
// Nested Loops 1
// 
// This program will take as nothing as input, and will calulate and output the 1
// to 12 times tables inclusive for 1 to 8 inclusive.
//////////////////////////////////////////////////////////////////////////////////
// Variables Used:
// MAX_NUM - Maximum number
// MAX_TABLE - Maximum table
// MIN_NUM - Minumum Number
// MIN_TABLE - Minimum table
// num - Current number within table
// product - Product
// table - Curruent times table
//////////////////////////////////////////////////////////////////////////////////

class NestedLoops1
{
 
  public static void main( String args[] )
  {
   
    final int MAX_NUM = 12, MAX_TABLE = 8, MIN_NUM = 1, MIN_TABLE = 1;
    int product = 0;
    
    System.out.println( "The times tables 1 to " + MAX_TABLE +
                       " for the numbers " + MIN_TABLE + "to " + MAX_NUM +
                       "are:  " );
    
    for ( int table = MIN_TABLE; table <= MAX_TABLE; table++ )
    {
     
      System.out.println( "" );
      
      for ( int num = MIN_NUM; num <= MAX_NUM; num++ )
      {
       
        product = table * num;
        System.out.println( table + " x " + num + " = " + product );
        
      }
      
    }
    
  }
  
}