From 6775ddcbd19666bc6128bea89d002f7970892826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=88=9C?= <1991510644@qq.com> Date: Wed, 10 May 2023 23:43:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=89=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...02\345\270\270\344\275\234\344\270\232.md" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "51 \347\250\213\350\210\234/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" diff --git "a/51 \347\250\213\350\210\234/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" "b/51 \347\250\213\350\210\234/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000..0e92d72 --- /dev/null +++ "b/51 \347\250\213\350\210\234/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,28 @@ +```java +public class Main { + public static void main(String[] args){ + while (true) { + try { + Scanner sc = new Scanner(System.in); + System.out.println("请输入第一个整数"); + int a = sc.nextInt(); + Scanner s = new Scanner(System.in); + System.out.println("请输入第二个整数"); + int b = sc.nextInt(); + int num=0; + if (a>0 && b>0){ + num=num+a+b; + System.out.println("输入值为"+num); + break; + }else if (a<0 && b<0){ + System.out.println("输入整数有误"); + break; + } + } catch (Exception e) { + System.out.println("输入类型有误"); + } + } + } +} +``` + -- Gitee