From e7d434aabfdac2fb12932ac838cd56d884e4d87e Mon Sep 17 00:00:00 2001 From: xuxin <840198532@qq.com> Date: Thu, 22 Jan 2026 11:28:38 +0800 Subject: [PATCH] =?UTF-8?q?day08-static=E5=BA=94=E7=94=A8-Math=E7=B1=BB-?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day08/src/com/inmind/math04/Test16.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); + } }