From f5829a71edf42af715089705a22fb6506b45d05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=82=E6=B3=BD=E7=85=9C?= <11435691+islover@user.noreply.gitee.com> Date: Wed, 14 Dec 2022 13:40:11 +0000 Subject: [PATCH 1/3] =?UTF-8?q?update=209=E6=A1=82=E6=B3=BD=E7=85=9C/?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A2.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 桂泽煜 <11435691+islover@user.noreply.gitee.com> --- .../\344\275\234\344\270\2322.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" index 6e0f13f..a5b6dd6 100644 --- "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" +++ "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" @@ -30,7 +30,7 @@ public class Main { if (a * i < 10) { System.out.print("\t\n"); for (a = 9; a >= i; a--) { - System.out.print(+a + "*" + i + "=" + (a * i) + "\t"); + System.out.print("\33[36;10m"+a + "*" + i + "=" + (a * i) + "\t"); } } -- Gitee From 384a4f874a0121f468e2486a28dd2098da4a6497 Mon Sep 17 00:00:00 2001 From: Your Name <2970307356@qq.com> Date: Thu, 15 Dec 2022 22:30:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=AC=ACN=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\2322.md" | 2 +- .../\344\275\234\344\270\2323.md" | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 "9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" diff --git "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" index a5b6dd6..9334fe5 100644 --- "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" +++ "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2322.md" @@ -21,7 +21,7 @@ public class Main { ``` ```java -import java.util.Random; + public class Main { public static void main(String[] args) { diff --git "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" new file mode 100644 index 0000000..e4a0041 --- /dev/null +++ "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" @@ -0,0 +1,55 @@ +作业 : + +3. 定义一函数,用于求2个数中的较大数,并将其返回,这2个数字在主函数中由用户输入 + + ```java + import java.util.Scanner; + + public class jhg { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("请输入a的值"); + int a = scanner.nextInt(); + System.out.println("请输入b的值"); + int b = scanner.nextInt(); + int s = getNum(a,b); + System.out.println("最大值为:"+s); + } + + private static int getNum(int a,int b) { + int max = a>b?a:b; + return max; + } + + } + ``` + + + +4. 在主函数中从键盘接收X, Y , Z3个数,编写函数计算这3个数的立方和并返回计算结果:S=X3+Y3+Z3 + +```java +import java.util.Scanner; + +public class jhg { + private static int X = 0; + private static int Z = 0; + private static int S = 0; + private static int Y = 0; + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("请输入X的值"); + X = scanner.nextInt(); + System.out.println("请输入Y的值"); + Y = scanner.nextInt(); + System.out.println("请输入Z的值"); + Z = scanner.nextInt(); + S = X*3+Y*3+Z*3; + System.out.println("这三个数的立方和为:"+S); + } + + +} +``` + -- Gitee From 87fd5223e9c3e8ad0924bb072a805becdc3447f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=82=E6=B3=BD=E7=85=9C?= <11435691+islover@user.noreply.gitee.com> Date: Thu, 15 Dec 2022 14:51:12 +0000 Subject: [PATCH 3/3] =?UTF-8?q?update=209=E6=A1=82=E6=B3=BD=E7=85=9C/?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A3.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 桂泽煜 <11435691+islover@user.noreply.gitee.com> --- .../\344\275\234\344\270\2323.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" index e4a0041..b3ab465 100644 --- "a/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" +++ "b/9\346\241\202\346\263\275\347\205\234/\344\275\234\344\270\2323.md" @@ -45,7 +45,7 @@ public class jhg { Y = scanner.nextInt(); System.out.println("请输入Z的值"); Z = scanner.nextInt(); - S = X*3+Y*3+Z*3; + S = X*X*X+Y*Y*Y+Z*Z*Z; System.out.println("这三个数的立方和为:"+S); } -- Gitee