Assignment #112 Odometer Loops

Code

    /// Name: DeeJay Cerezo
/// Period: 7
/// Program Name: Odometer
/// File Name: Odo.java
/// Date Finished: 4/12/2016


public class Odo
    
{
	public static void main( String[] args )
	{
		// this is #1 - I'll call it "CN"
			for ( int n=1; n <= 3; n++ )
			{
               for ( char c='A'; c <= 'E'; c++ )
               {
		 
				System.out.println( c + " " + n );
               }
			}
        //The for loop for n changes faster.
        //reversing the loops gives a change in output order.

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

		// this is #2 - I'll call it "AB"
		for ( int a=1; a <= 3; a++ )
		{
			for ( int b=1; b <= 3; b++ )
			{
				System.out.print( a + "-" + b + " " );
			}
            System.out.println();
            //Changing to println causes the for loop to go to the next line after each repeat.
            //Adding a Sytem.out.println() will run to the next run after the inner for loop finishes. 
			// * You will add a line of code here.
		}

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

	}
}




    
    

Picture of the output

Assignment