/**
* Times nested loops run
*
* @author TK Rogers
* @version 12-24-10
*/
public class LoopsTimesRun
{
public static void main ( ) {
int outerLoopCounter = 0 , // counts the # of times the outer loo; runs
innerLoopCounter = 0 ; // counts the # of times the inner loo; runs}
for ( int x = 0 ; x < 3 ; x++ ) { // outer loop
for ( int y = 0 ; y < 5 ; y++ ) { // inner loop
innerLoopCounter++ ;
}
outerLoopCounter++ ;
}
System.out.println ( "inner loop ran " + innerLoopCounter + " times, ") ;
System.out.print ( "outer loop ran " + outerLoopCounter + " times, ") ;
}
}