Value

 1 package JavaMath;
 2 /*
 3     计算在-10.8到5.9之间,绝对值大于6或者小于2.1的整数有多少个
 4  */
 5 public class Work1 {
 6     public static void main(String[] args){
 7         int count = 0;
 8         double min = -10.8;
 9         double max = 5.9;
10         for (int i = (int)min; i <= 5.9; i++){
11             int abs = Math.abs(i);
12             if (abs > 6 || abs < 2.1){
13                 count++;
14                 System.out.println(i);
15             }
16         }
17         System.out.println("一共有"+count);
18     }
19 }
原文地址:https://www.cnblogs.com/bingquan1/p/12540580.html