diff --git a/day08/src/com/inmind/math04/Test16.java b/day08/src/com/inmind/math04/Test16.java index b7e8457..64a027a 100644 --- a/day08/src/com/inmind/math04/Test16.java +++ b/day08/src/com/inmind/math04/Test16.java @@ -7,4 +7,19 @@ package com.inmind.math04; 定义一个变量来计数 */ public class Test16 { + public static void main(String[] args) { + double start = -10.8; + double end = 5.9; + int count = 0; + + for (double i = Math.ceil(start); i < end ; i++) { + System.out.print(i+" "); + //条件>6||<2.1 + if (Math.abs(i) > 6 || Math.abs(i) < 2.1) { + count++; + } + } + System.out.println(); + System.out.println(count); + } }