/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package quadratic; /** * * @author suchenek */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int cnt = 0; for(int n = 1; n < 100; n++) { for(int i = 1; i < n; i++) { cnt++; for (int j = 0; j < i; j++) cnt++; } System.out.println("n = " + n + " cnt = " + cnt + " (0.5*n*n)+0.5*n - 1 = " + ((0.5*n*n)+0.5*n - 1)); cnt = 0; } } }