Prog 111: Nesting Loops
///Name: Ilana Levy
///Period: 5
///Program Name: Nesting Loops
///File Name: nestingLoops.java
///Date Finished: 10/5/2015
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.print( "Hi, Mr. Davis" );
}
System.out.println("\n");
}
}
///The value of the inner loop changes faster. The value of the variable is controlled by the inner loop.
///2. The letters change more frequently while the numbers stay the same.
///3. Each numbered pair of a-b is on a new line.
///4. The phrase I typed is repeated every time "a" increases.