8楼思路对的。public class d { public static void main(String[] args) { int a=9; int b=3; Int count= 0; for(int i=0;i<a;i++){ If(a==b) break; b++; count++; } System.err.println(count); } }
class Test { public static void main(String[] args) { Sum(15,6); } public static void Sum(int a,int b) { int num = 0; int max = a; int mid = b; for(int x=mid ;x<max;x++) { num++; } System.out.println(num); } }