Assignemnt #111 and Nesting Loops

Code

    /// Name: Brian Phillips
    /// Period: 5
    /// Program name:Nesting Loops
    /// File Name: Nest.java
    /// Date Finished: 5/4/2016
public class Nest
{
    public static void main( String[] args )
    {
        // this is #1 
        for ( int n=1; n <= 3; n++ )
        {
            for ( char c='A'; c <= 'E'; c++ ) //The inner one changes faster and is controlled by the inner loop
            {
                System.out.println( c + " " + n );
            }
        }
//swapping the two puts numbers before letters instead of letters first
        System.out.println("\n");

        // this is #2 - I'll call it "AB"//with println they now print each line
        for ( int a=1; a <= 3; a++ )
        {
            for ( int b=1; b <= 3; b++ )
            {
                System.out.print( a + "-" + b + " " );
            }
            System.out.println();   //output now has a space between lines.
        }

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

    }
}
    

Picture of the output

Nest.html