1到100求和

     private static int getSum(int start,int end){
int n=0;
int temp = start+end;
while(end>start){
n+=temp;
start++;
end--;
}
if(end==start)
n+=start;
return n;
}

听别人说的一个笔试题,弄了下

原文地址:https://www.cnblogs.com/slider/p/2344291.html