From 34743fc07f746c05ce107c06d63a5be9fb9ed823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E4=BA=A8=E8=80=80?= <2640788668@qq.com> Date: Mon, 19 Dec 2022 10:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...52\346\225\260\346\257\224\350\276\203.md" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "21 \345\215\242\344\272\250\350\200\200/20221216 \344\270\211\344\270\252\346\225\260\347\232\204\347\253\213\346\226\271\345\222\214\344\270\216\344\270\244\344\270\252\346\225\260\346\257\224\350\276\203.md" diff --git "a/21 \345\215\242\344\272\250\350\200\200/20221216 \344\270\211\344\270\252\346\225\260\347\232\204\347\253\213\346\226\271\345\222\214\344\270\216\344\270\244\344\270\252\346\225\260\346\257\224\350\276\203.md" "b/21 \345\215\242\344\272\250\350\200\200/20221216 \344\270\211\344\270\252\346\225\260\347\232\204\347\253\213\346\226\271\345\222\214\344\270\216\344\270\244\344\270\252\346\225\260\346\257\224\350\276\203.md" new file mode 100644 index 0000000..80a43a8 --- /dev/null +++ "b/21 \345\215\242\344\272\250\350\200\200/20221216 \344\270\211\344\270\252\346\225\260\347\232\204\347\253\213\346\226\271\345\222\214\344\270\216\344\270\244\344\270\252\346\225\260\346\257\224\350\276\203.md" @@ -0,0 +1,33 @@ +# 作业 + +```java +package luhengyao; + +import java.util.Scanner; +//3. 定义一函数,用于求2个数中的较大数,并将其返回,这2个数字在主函数中由用户输入 +public class D5 { + public static void main(String[] args) { + maxnum(); + qwe(); + } + public static void maxnum(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入你要比较的数:"); + int a= sc.nextInt(); + int b= sc.nextInt(); + int max=(a>b? a:b); + System.out.println("最大值为"+max); + } + //4. 在主函数中从键盘接收X, Y , Z3个数,编写函数计算这3个数的立方和并返回计算结果:S=X3+Y3+Z3 + public static void qwe(){ + Scanner sc=new Scanner(System.in); + System.out.println("输入xyz的值:"); + double x= sc.nextDouble(); + double y= sc.nextDouble(); + double z= sc.nextDouble(); + double s=x*x*x+y*y*y+z*z*z; + System.out.println(s); + } +} +``` + -- Gitee