From 9c200af9ba9fd5dca4f2909f85041361d950fb0b Mon Sep 17 00:00:00 2001 From: syx6666 <1551324662@qq.com> Date: Sat, 2 Jan 2021 17:19:38 +0800 Subject: [PATCH 1/2] first commit --- .../L01.java" | 17 ++++++++++ .../L02.java" | 32 +++++++++++++++++++ .../L03.java" | 28 ++++++++++++++++ .../L04.java" | 30 +++++++++++++++++ .../L05.java" | 27 ++++++++++++++++ .../L06.java" | 29 +++++++++++++++++ 6 files changed, 163 insertions(+) create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L01.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L02.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L03.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L04.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L05.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L06.java" diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L01.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L01.java" new file mode 100644 index 0000000..65e28fa --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L01.java" @@ -0,0 +1,17 @@ + +public class L01 { + public static void main(String[] args) { + // TODO Auto-generated method stub + int x=1; + + + for (int i = 0; i < 9; i++) { + + x=(x+1)*2; + + + System.out.println("芄思"+x); + + } +} + } diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L02.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L02.java" new file mode 100644 index 0000000..e5e049c --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L02.java" @@ -0,0 +1,32 @@ + +public class L02 { + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner scan = new Scanner(System.in); + int a = 0; + int b; + for (int i = 0; i <4; i++) { + System.out.println("请输入金额"); + b = scan.nextInt(); + + + + if (b==-1) { + + break; + + } + if (b<=0) { + System.out.println("输入报错"); + continue; + + + } + a=a+b; + + } + System.out.println("总金额是"+a); + + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L03.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L03.java" new file mode 100644 index 0000000..ecc6ce3 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L03.java" @@ -0,0 +1,28 @@ + +public class L03 { + public static void main(String[] args) { + // TODO Auto-generated method stub + for (int i = 1; i < 6; i++) { + for(int a=1;a<=6-i;a++){ + System.out.print(" "); + } + + for(int b=1;b<=2*i-1;b++) { + System.out.print("*"); + } + System.out.println(); + } + for (int j = 1; j <= 4; j++) { + for(int c=1;c<=j+1;c++){ + System.out.print(" "); + + } + + for(int d=1;d<=9-2*j;d++) { + System.out.print("*"); + } + System.out.println(); + + } + +}} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L04.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L04.java" new file mode 100644 index 0000000..289d0f0 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L04.java" @@ -0,0 +1,30 @@ + +public class L04 { + // TODO Auto-generated method stub + int sum=0; + Scanner scanner=new Scanner(System.in); + int []a=new int [5]; + for(int i=0;i<5;i++) { + System.out.println("输入员工的年龄"); + a[i]=scanner.nextInt(); + + sum+=a[i]; + } + int max=a[0]; + int min=a[0]; + for (int c=1;c<5;c++) { + if(maxa[e]) { + min=a[e]; + } + } + System.out.println("平均年龄为:"+sum/5); + System.out.println("年龄最大为:"+max); + System.out.println("年龄最小为:"+min); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L05.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L05.java" new file mode 100644 index 0000000..b956843 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L05.java" @@ -0,0 +1,27 @@ + +public class L05 { + public static void main(String[] args) { + + Scanner scanner=new Scanner(System.in); + int []a=new int[6]; + int sum=0; + for (int i = 0; i < 6; i++) { + System.out.println("请为选手评分"); + a[i]=scanner.nextInt(); + sum+=a[i]; + } + int max=a[0]; + int min=a[0]; + for(int k=1;k<6;k++) { + if(maxa[g]) { + min=a[g]; + } + } + System.out.println("选手最终得分为:"+((sum-max-min)/4)); + } +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L06.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L06.java" new file mode 100644 index 0000000..874720f --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\225\206\350\265\242\346\227\255/L06.java" @@ -0,0 +1,29 @@ + +public class L06 { + public static void main(String[] args) { + for(int i=1;i<=5;i++) { + for(int a=1;a<=6-i;a++){ + System.out.print(" "); + } + + for(int b=1;b<=2*i-1;b++) { + System.out.print("*"); + + } + System.out.println(); + } + for(int g=1;g<=4;g++) { + for(int a=1;a<=g+1;a++){ + System.out.print(" "); + } + + for(int b=1;b<=9-2*g;b++) { + System.out.print("*"); + + } + System.out.println(); + } + + } + +} -- Gitee From 330b83ade32bc58f8162e6fe59639019349375ac Mon Sep 17 00:00:00 2001 From: syx6666 <1551324662@qq.com> Date: Sat, 2 Jan 2021 21:34:30 +0800 Subject: [PATCH 2/2] first commit --- .../Demo1.java" | 15 +++++++++ .../Demo2.java" | 25 +++++++++++++++ .../Demo3.java" | 28 ++++++++++++++++ .../Demo4.java" | 25 +++++++++++++++ .../Demo5.java" | 27 ++++++++++++++++ .../Demo6.java" | 18 +++++++++++ .../Demo7.java" | 32 +++++++++++++++++++ .../Demo8.java" | 20 ++++++++++++ .../Demo9.java" | 17 ++++++++++ .../Demo1.java" | 15 +++++++++ .../Demo2.java" | 25 +++++++++++++++ .../Demo3.java" | 28 ++++++++++++++++ .../Demo4.java" | 25 +++++++++++++++ .../Demo5.java" | 27 ++++++++++++++++ .../Demo6.java" | 18 +++++++++++ .../Demo7.java" | 32 +++++++++++++++++++ .../Demo8.java" | 20 ++++++++++++ .../Demo9.java" | 17 ++++++++++ .../\346\236\227\345\263\260/Demo1.java" | 15 +++++++++ .../\346\236\227\345\263\260/Demo2.java" | 25 +++++++++++++++ .../\346\236\227\345\263\260/Demo3.java" | 28 ++++++++++++++++ .../\346\236\227\345\263\260/Demo4.java" | 25 +++++++++++++++ .../\346\236\227\345\263\260/Demo5.java" | 27 ++++++++++++++++ .../\346\236\227\345\263\260/Demo6.java" | 18 +++++++++++ .../\346\236\227\345\263\260/Demo7.java" | 32 +++++++++++++++++++ .../\346\236\227\345\263\260/Demo8.java" | 20 ++++++++++++ .../\346\236\227\345\263\260/Demo9.java" | 17 ++++++++++ 27 files changed, 621 insertions(+) create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo1.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo2.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo3.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo4.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo5.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo6.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo7.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo8.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo9.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo1.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo2.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo3.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo4.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo5.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo6.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo7.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo8.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo9.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo1.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo2.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo3.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo4.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo5.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo6.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo7.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo8.java" create mode 100644 "Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo9.java" diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo1.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo1.java" new file mode 100644 index 0000000..44458b0 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo1.java" @@ -0,0 +1,15 @@ +package com.md.lession7; + +public class Demo1 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int i=1;i<10;i++) { + for(int j=1;j<=i;j++) { + System.out.print(j+"*"+i+"="+i*j+"\t"); + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo2.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo2.java" new file mode 100644 index 0000000..dc242e9 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo2.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo2 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + if (a==1||a==i||b==1||b==i) { + System.out.print("*"); + }else { + System.out.print(" "); + } + + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo3.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo3.java" new file mode 100644 index 0000000..0c87973 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo3.java" @@ -0,0 +1,28 @@ +package com.md.lession7; + +public class Demo3 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int a=1;a<=5;a++) { + for(int b=1;b<=6-a;b++) { + System.out.print(" "); + + } + for(int b=1;b<=2*a-1;b++) { + System.out.print("*"); + } + System.out.println(""); + } + for(int g=1;g<=4;g++) { + for(int a=1;a<=g+1;a++) { + System.out.print(" "); + } + for(int b=1;b<=8-2*g;b++) { + System.out.print("*"); + } + System.out.println("*"); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo4.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo4.java" new file mode 100644 index 0000000..2cc8162 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo4.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo4 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + System.out.print("*"); + if (b==5) { + System.out.print("\t"); + } + + } + System.out.println(""); + + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo5.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo5.java" new file mode 100644 index 0000000..98a588a --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo5.java" @@ -0,0 +1,27 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo5 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int sum=0; + int a; + Scanner scanner=new Scanner(System.in); + while (true) { + System.out.println("输入消费金额"); + a=scanner.nextInt(); + if(a<=0&&a!=-1) { + System.out.println("报错,"); + continue; + } + if(a==-1) { + break; + } + sum+=a; + } + System.out.println("消费总额为:"+sum); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo6.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo6.java" new file mode 100644 index 0000000..e450c40 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo6.java" @@ -0,0 +1,18 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo6 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a=1; + + Scanner scanner=new Scanner(System.in); + for (int i = 1; i < 10; i++) { + a=(a+1)*2; + } + System.out.println(a); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo7.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo7.java" new file mode 100644 index 0000000..56fab87 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo7.java" @@ -0,0 +1,32 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo7 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner scanner=new Scanner(System.in); + int []a=new int[6]; + int sum=0; + for (int i = 0; i < 6; i++) { + System.out.println("请为选手评分"); + a[i]=scanner.nextInt(); + sum+=a[i]; + } + int max=a[0]; + int min=a[0]; + for(int k=1;k<6;k++) { + if(maxa[g]) { + min=a[g]; + } + } + System.out.println("选手最终得分为:"+((sum-max-min)/4)); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo8.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo8.java" new file mode 100644 index 0000000..f85f58d --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo8.java" @@ -0,0 +1,20 @@ +package com.md.lession7; + +public class Demo8 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a; + int b; + int c; + for(int i=100;i<1000;i++) { + a=i/100; + b=i%100/10; + c=i%100%10; + if ((a*a*a)+(b*b*b)+(c*c*c)==i) { + System.out.println(""+i); + } + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo9.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo9.java" new file mode 100644 index 0000000..cc07c48 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\224\220\345\207\241\350\276\211/Demo9.java" @@ -0,0 +1,17 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo9 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int arr[]= {19,28,37,46,50}; + Scanner scanner = new Scanner(System.in); + System.out.println("请输入一个有用的数据"); + int i=scanner.nextInt(); + int sum=arr[i]; + System.out.println("索引值为:"+sum); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo1.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo1.java" new file mode 100644 index 0000000..44458b0 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo1.java" @@ -0,0 +1,15 @@ +package com.md.lession7; + +public class Demo1 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int i=1;i<10;i++) { + for(int j=1;j<=i;j++) { + System.out.print(j+"*"+i+"="+i*j+"\t"); + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo2.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo2.java" new file mode 100644 index 0000000..dc242e9 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo2.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo2 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + if (a==1||a==i||b==1||b==i) { + System.out.print("*"); + }else { + System.out.print(" "); + } + + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo3.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo3.java" new file mode 100644 index 0000000..0c87973 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo3.java" @@ -0,0 +1,28 @@ +package com.md.lession7; + +public class Demo3 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int a=1;a<=5;a++) { + for(int b=1;b<=6-a;b++) { + System.out.print(" "); + + } + for(int b=1;b<=2*a-1;b++) { + System.out.print("*"); + } + System.out.println(""); + } + for(int g=1;g<=4;g++) { + for(int a=1;a<=g+1;a++) { + System.out.print(" "); + } + for(int b=1;b<=8-2*g;b++) { + System.out.print("*"); + } + System.out.println("*"); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo4.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo4.java" new file mode 100644 index 0000000..2cc8162 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo4.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo4 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + System.out.print("*"); + if (b==5) { + System.out.print("\t"); + } + + } + System.out.println(""); + + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo5.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo5.java" new file mode 100644 index 0000000..98a588a --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo5.java" @@ -0,0 +1,27 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo5 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int sum=0; + int a; + Scanner scanner=new Scanner(System.in); + while (true) { + System.out.println("输入消费金额"); + a=scanner.nextInt(); + if(a<=0&&a!=-1) { + System.out.println("报错,"); + continue; + } + if(a==-1) { + break; + } + sum+=a; + } + System.out.println("消费总额为:"+sum); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo6.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo6.java" new file mode 100644 index 0000000..e450c40 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo6.java" @@ -0,0 +1,18 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo6 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a=1; + + Scanner scanner=new Scanner(System.in); + for (int i = 1; i < 10; i++) { + a=(a+1)*2; + } + System.out.println(a); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo7.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo7.java" new file mode 100644 index 0000000..56fab87 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo7.java" @@ -0,0 +1,32 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo7 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner scanner=new Scanner(System.in); + int []a=new int[6]; + int sum=0; + for (int i = 0; i < 6; i++) { + System.out.println("请为选手评分"); + a[i]=scanner.nextInt(); + sum+=a[i]; + } + int max=a[0]; + int min=a[0]; + for(int k=1;k<6;k++) { + if(maxa[g]) { + min=a[g]; + } + } + System.out.println("选手最终得分为:"+((sum-max-min)/4)); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo8.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo8.java" new file mode 100644 index 0000000..f85f58d --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo8.java" @@ -0,0 +1,20 @@ +package com.md.lession7; + +public class Demo8 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a; + int b; + int c; + for(int i=100;i<1000;i++) { + a=i/100; + b=i%100/10; + c=i%100%10; + if ((a*a*a)+(b*b*b)+(c*c*c)==i) { + System.out.println(""+i); + } + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo9.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo9.java" new file mode 100644 index 0000000..cc07c48 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\234\261\345\245\207\344\274\237/Demo9.java" @@ -0,0 +1,17 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo9 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int arr[]= {19,28,37,46,50}; + Scanner scanner = new Scanner(System.in); + System.out.println("请输入一个有用的数据"); + int i=scanner.nextInt(); + int sum=arr[i]; + System.out.println("索引值为:"+sum); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo1.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo1.java" new file mode 100644 index 0000000..44458b0 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo1.java" @@ -0,0 +1,15 @@ +package com.md.lession7; + +public class Demo1 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int i=1;i<10;i++) { + for(int j=1;j<=i;j++) { + System.out.print(j+"*"+i+"="+i*j+"\t"); + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo2.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo2.java" new file mode 100644 index 0000000..dc242e9 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo2.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo2 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + if (a==1||a==i||b==1||b==i) { + System.out.print("*"); + }else { + System.out.print(" "); + } + + } + System.out.println(""); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo3.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo3.java" new file mode 100644 index 0000000..0c87973 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo3.java" @@ -0,0 +1,28 @@ +package com.md.lession7; + +public class Demo3 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + for(int a=1;a<=5;a++) { + for(int b=1;b<=6-a;b++) { + System.out.print(" "); + + } + for(int b=1;b<=2*a-1;b++) { + System.out.print("*"); + } + System.out.println(""); + } + for(int g=1;g<=4;g++) { + for(int a=1;a<=g+1;a++) { + System.out.print(" "); + } + for(int b=1;b<=8-2*g;b++) { + System.out.print("*"); + } + System.out.println("*"); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo4.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo4.java" new file mode 100644 index 0000000..2cc8162 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo4.java" @@ -0,0 +1,25 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo4 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sca=new Scanner(System.in); + System.out.println(""); + int i=sca .nextInt(); + for(int a=1;a<=i;a++) { + for(int b=1;b<=i;b++) { + System.out.print("*"); + if (b==5) { + System.out.print("\t"); + } + + } + System.out.println(""); + + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo5.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo5.java" new file mode 100644 index 0000000..98a588a --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo5.java" @@ -0,0 +1,27 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo5 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int sum=0; + int a; + Scanner scanner=new Scanner(System.in); + while (true) { + System.out.println("输入消费金额"); + a=scanner.nextInt(); + if(a<=0&&a!=-1) { + System.out.println("报错,"); + continue; + } + if(a==-1) { + break; + } + sum+=a; + } + System.out.println("消费总额为:"+sum); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo6.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo6.java" new file mode 100644 index 0000000..e450c40 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo6.java" @@ -0,0 +1,18 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo6 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a=1; + + Scanner scanner=new Scanner(System.in); + for (int i = 1; i < 10; i++) { + a=(a+1)*2; + } + System.out.println(a); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo7.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo7.java" new file mode 100644 index 0000000..56fab87 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo7.java" @@ -0,0 +1,32 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo7 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner scanner=new Scanner(System.in); + int []a=new int[6]; + int sum=0; + for (int i = 0; i < 6; i++) { + System.out.println("请为选手评分"); + a[i]=scanner.nextInt(); + sum+=a[i]; + } + int max=a[0]; + int min=a[0]; + for(int k=1;k<6;k++) { + if(maxa[g]) { + min=a[g]; + } + } + System.out.println("选手最终得分为:"+((sum-max-min)/4)); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo8.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo8.java" new file mode 100644 index 0000000..f85f58d --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo8.java" @@ -0,0 +1,20 @@ +package com.md.lession7; + +public class Demo8 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int a; + int b; + int c; + for(int i=100;i<1000;i++) { + a=i/100; + b=i%100/10; + c=i%100%10; + if ((a*a*a)+(b*b*b)+(c*c*c)==i) { + System.out.println(""+i); + } + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo9.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo9.java" new file mode 100644 index 0000000..cc07c48 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\346\236\227\345\263\260/Demo9.java" @@ -0,0 +1,17 @@ +package com.md.lession7; + +import java.util.Scanner; + +public class Demo9 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int arr[]= {19,28,37,46,50}; + Scanner scanner = new Scanner(System.in); + System.out.println("请输入一个有用的数据"); + int i=scanner.nextInt(); + int sum=arr[i]; + System.out.println("索引值为:"+sum); + } + +} -- Gitee