Assignemnt #111: NestingLoops

Code

    /// Name: Kelsey Lieberman
    /// Period 5
    /// Program Name: NestingLoops
    /// File Name: NestingLoops.java
    /// Date Finished: 2/9/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 );
            }
        }

        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();
        }

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

    }
}

/* 
    1.) The "n" variable changes faster. The inner loop controlled variable changes faster.
    2.) inner llop still changes faster so the output changes b/c A-E runs faster than 1-3.
    3.) the output changes b/c it prints a new line each time the inner loop fineshes an iteration
    4.) the output changes because now it only prints a new line each time the outer loop fineshes an iteration
*/ 
    

Picture of the output

Assignment 111