Assignment #111 and Nesting Loops

Code

    /// Name: Lauren Baird
    /// Period: 7
    /// Program Name: Nesting Loops
    /// File Name: NestingLoops.java
    /// Date Finished: 1/26/2016
    
    public class NestingLoops
    {
    	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 );
    			}
    		}
            
            // Before adjusting the code, the variable 'N' changes faster
            // After adjusting the code, the letters changed before the numbers did
    
    		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();
                // Adding the statement above makes it so the set of numbers both line up and stack on each other
    		}
            
            // When you change the 'print()' statement to be a 'println()' statement, each set of numbers will appear on top of each other instead of next to each other
    
    		System.out.println("\n");
    
    	}
    }
      
    

Picture of the output

Assignment #111