Assignment #111
Code
/// Name: Jonathan Stine
/// Period: 5
/// Program Name: Nesting Loops
/// File Name: NestingLoops.java
/// Date Finished: 4/22/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 + " " );
}
// * You will add a line of code here.
System.out.println( "Beep Boop" );
}
System.out.println("\n");
}
}
/// 1. The inner loop changes faster.
/// 2. This causes the letter loop to change faster.
/// 3. This causes each n-n number pair to print on a separate line.
/// 4. This makes it so that every three number pairs "Frog" is printed and it jumps to the next line.
Code Output