diff --git "a/17 \345\221\250\345\257\214/20221215 \345\244\215\344\271\240\344\275\234\344\270\232.md" "b/17 \345\221\250\345\257\214/20221215 \345\244\215\344\271\240\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..07dea28be9a3bcab384f1efc3b8abedce160abda --- /dev/null +++ "b/17 \345\221\250\345\257\214/20221215 \345\244\215\344\271\240\344\275\234\344\270\232.md" @@ -0,0 +1,28 @@ +## 作业 + +```java +public class a5 { + public static void main(String[] args) { + for (int i=0;i<=100;i++){ + if (4.05*i+(100-i)*5.06==445.4){ + System.out.println(i); + System.out.println(100-i); + } + } + } +} +``` + +```java +public class a4 { + public static void main(String[] args) { + for (int i=1;i<=9;i++){ + System.out.println(); + for (int j=1;j<=i;j++){ + System.out.print(i+"x"+j+"="+(i*j)+"\t"); + } + + } + } +} +``` \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20221218 \346\226\271\346\263\225\344\275\234\344\270\232.md" "b/17 \345\221\250\345\257\214/20221218 \346\226\271\346\263\225\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..574d2253f70b07e3793cbe20e6369a3b3103bcd0 --- /dev/null +++ "b/17 \345\221\250\345\257\214/20221218 \346\226\271\346\263\225\344\275\234\344\270\232.md" @@ -0,0 +1,54 @@ +## 作业 + +```java +import java.util.Scanner; +// 定义一函数,用于求2个数中的较大数,并将其返回,这2个数字在主函数中由用户输入 +public class a7 { + public static void main(String[] args) { + int c = (int) max(z(),s()); + System.out.println("最大值为"+c); + } + public static double max(int a , int b){ + return a>b?a:b; + } + public static int z(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入整数"); + return sc.nextInt(); + } + public static int s(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入整数"); + return sc.nextInt(); + } +} +``` + +```java +import java.util.Scanner; +//在主函数中从键盘接收X, Y , Z3个数,编写函数计算这3个数的立方和并返回计算结果:S=X3+Y3+Z3 +public class a8 { + public static void main(String[] args) { + int lf=(int)he(x(),y(),z()); + System.out.println("他们的立法和为"+lf); + } + public static int he(int a,int b,int c){ + return a*a*a+b*b*b+c*c*c; + } + public static int x(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入整数"); + return sc.nextInt(); + } + public static int y(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入整数"); + return sc.nextInt(); + } + public static int z(){ + Scanner sc=new Scanner(System.in); + System.out.println("请输入整数"); + return sc.nextInt(); + } +} +``` \ No newline at end of file