本帖最后由 曾宇 于 2016-2-24 15:39 编辑
- public static void main(String[] args) {
- double max =100;
- double mid =max/2;
- double count =0;
- CountEx(max,mid,count);
- }
-
- public static void CountEx(double max,double mid,double count){
- count=count+mid*2;
- if(max>=1&&mid>=1){
- mid=max/2;
- max= mid;
- CountEx(max,mid,count);
- }else{
- System.out.println(count);
- }
- }
复制代码 我得出的结果是298.4375 |