diff --git "a/11 \351\202\271\344\272\250\344\274\237/20221218\346\226\271\346\263\225\350\277\220\347\224\250\344\275\234\344\270\232.md" "b/11 \351\202\271\344\272\250\344\274\237/20221218\346\226\271\346\263\225\350\277\220\347\224\250\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..6405e07bdb6ccb25a31a109296195d0ff5929453 --- /dev/null +++ "b/11 \351\202\271\344\272\250\344\274\237/20221218\346\226\271\346\263\225\350\277\220\347\224\250\344\275\234\344\270\232.md" @@ -0,0 +1,51 @@ + + +# 作业 + +请输入三个数求三个数的立方和 + +```java +import java.util.Scanner; + +public class W2 { + public static void main(String[] args) { + Scanner Sc = new Scanner(System.in); + System.out.println("请输入三个数求三个数的立方和"); + int x = Sc.nextInt(); + int y = Sc.nextInt(); + int z = Sc.nextInt(); + lifan(x,y,z); + } + + public static void lifan(int x,int y,int z){ + System.out.println( x*3+y*3+z*3); + + } +} + +``` + + + +用键盘输入两个数来比较最大值 + +```java +import java.util.Scanner; + +public class W1 { + public static void main(String[] args) { + Scanner Sc = new Scanner(System.in); + System.out.println("请输入两个数来比较最大值"); + int a = Sc.nextInt(); + int b = Sc.nextInt(); + max(a,b); + } + public static void max(int a,int b){ + if (a>b) { + System.out.println("最大的值是"+a); + }else{ + System.out.println("最大的值是"+b); + } + } +} +``` \ No newline at end of file