// For Loop Counting Demo, M.S. Branicky, 09/20/2007

public class CountDemo {
  public static void main (String[] args) {
    
    int i, last, first, inc, prediction, count;
    
    first = -200;
    last  = 4999;
    inc   = 1;

/*
    first = 0;
    last  = 100;
    inc   = 12;
*/

    prediction = (last-first)/inc + 1;
    System.out.println("Formula: loop body will execute " + prediction + " times");

    count = 0;
    for (i=first; i<=last; i+=inc) {
      count++;
    }
    System.out.println("Loop body was actually executed " + count + " times");

  }
}
