Assignement: Nested ForLoops

Code

 /// Name: Sean Harrison
    /// Period: 7
    /// Program name: NestingLoops
    /// File Name: NestingLoops.html
    /// Date Finished: 4/24/2016
    

public class NestingLoops
{
	public static void main( String[] args )
	{
		// this is #1 It's termed "CN"
			for ( int n=1; n <= 3; n++ )
			{
               for ( char c='A'; c <= 'E'; c++ )
               {
		 
				System.out.println( c + " " + n );
               }
			}
        //The for n increases faster as the loop is changed.
        //reverse loops lead to a different output order produced.
		System.out.println("\n");

		// this is #2 it's termed "AB"
		for ( int a=1; a <= 3; a++ )
		{
			for ( int b=1; b <= 3; b++ )
			{
				System.out.print( a + "-" + b + " " );
			}
            System.out.println();
            //By changing it to println it causes the loop to run on the next line
            //Adding a Sytem.out.println() will begin the next loop as soon as the inner for loop wraps up.
			
		}

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

	}
}
            
       
 

Picture of the output

Assignment 111