int a = 1; // a gets value from user int j=0; for(int i=a;i<10;i++) { // code goes here j = j++; if(j==10) break; }