From df5cdfeef0f2d534271a17f11d45fc2cdd351495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Sun, 4 Dec 2022 19:32:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AC=AC=E4=BA=94=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...47\345\210\266\350\257\255\345\217\245.md" | 0 ...221204 javafor\345\276\252\347\216\257.md" | 45 +++++++++++++++++++ 2 files changed, 45 insertions(+) rename "18 \345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" => "18 \345\276\220\346\260\270\346\267\263/20221121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" (100%) create mode 100644 "18 \345\276\220\346\260\270\346\267\263/20221204 javafor\345\276\252\347\216\257.md" diff --git "a/18 \345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" "b/18 \345\276\220\346\260\270\346\267\263/20221121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" similarity index 100% rename from "18 \345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" rename to "18 \345\276\220\346\260\270\346\267\263/20221121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" diff --git "a/18 \345\276\220\346\260\270\346\267\263/20221204 javafor\345\276\252\347\216\257.md" "b/18 \345\276\220\346\260\270\346\267\263/20221204 javafor\345\276\252\347\216\257.md" new file mode 100644 index 0000000..69d5776 --- /dev/null +++ "b/18 \345\276\220\346\260\270\346\267\263/20221204 javafor\345\276\252\347\216\257.md" @@ -0,0 +1,45 @@ +for (初始化语句;条件判断语句;条件控制语句) { + + 循环体语句; + + } + +作业 + +让用户输入一个数字,根据这个数字,循环输出"我爱学习,我爱java",比如,用户输入数字 9 就在控制台输出9行"我爱学习,我爱java" + +```java +import java.util.Scanner; + +public class aadf { + public static void main(String[] args) { + Scanner as=new Scanner(System.in); + System.out.println("输入一个一个一个数字"); + int aw=as.nextInt(); + for (int a=1;a<=aw;a++){ + System.out.println("god gundam!!!god finger!! heart end!!fuunsaiki!!"); + } + } +} +``` + +用户分别输入数 a,数b,让程序实现从a 开始循环到b.输出"有生之年,能看到中国队出线吗?" + +```java +import java.util.Scanner; + +public class awer { + public static void main(String[] args) { + Scanner ne=new Scanner(System.in); + System.out.println("给👴要的开始的次数"); + int as=ne.nextInt(); + Scanner aw=new Scanner(System.in); + System.out.println("给👴想要结束的次数次数"); + int az=aw.nextInt(); + + for (int j=az;j<=as;j++){ + System.out.println("是否固定收费的方式"); + } + } + } +``` \ No newline at end of file -- Gitee From c1cb67ed616ca1c8dd29fc253273c2510535914b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 6 Dec 2022 20:28:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AC=AC=E4=BA=94=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221206 javawhite.md" | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 "18 \345\276\220\346\260\270\346\267\263/20221206 javawhite.md" diff --git "a/18 \345\276\220\346\260\270\346\267\263/20221206 javawhite.md" "b/18 \345\276\220\346\260\270\346\267\263/20221206 javawhite.md" new file mode 100644 index 0000000..132f03c --- /dev/null +++ "b/18 \345\276\220\346\260\270\346\267\263/20221206 javawhite.md" @@ -0,0 +1,82 @@ +while (条件判断语句) + +{ + + 循环体语句; + +条件控制语句; + +} + +作业 + +1.求555 555的约数中最大的三位数。 + +提示:最大的三位数介于100~999 之间,根据题意,求其中最大的,所以需要从大到小循环。 + +```java +public class test { + public static void main(String[] args) { + int count=0; + int i=555555; + int j; + for (j=999;j>=100;j--){ + count=i%j; + if (count==0){ + System.out.println(j); + break; + } + } + } + } +``` + +2. 猜数宇游戏。由系统随机生成一个随机(数字(100~ 999)之间,生成方法为intnumRandomO.nxtInt(100)。用户去猜测,如果太大,系统将提示“你猜的数字太大了!再猜”太小则提示“你猜的数字太小了,再猜”,猜中则提示“恭喜你,猜对了!”。猜数字的过程中需要统计用户猜测次数,如果用户一- 次性猜对,提示“你太厉害了,次就猜对”,2~6次提示“你很聪明!”,6次以上才猜中的话,提示“笨笨,你猜这么多次! + +```java +import java.util.Random; +import java.util.Scanner; + +public class jhg { + public static void main(String[] args) { + Random as = new Random(); + int ad = as.nextInt(100); + int count = 0; + while (count<=6) { +Scanner sc=new Scanner(System.in); + System.out.println("输入数字"); + int ae= sc.nextInt(); + if (aead){ + System.out.println("太大"); + count++; + } + if (ae==ad){ + System.out.println("对了"); + count++; + break; + } + } + switch (count) { + case 1: + System.out.println("你太聪明"); + break; + case 2: + case 3: + case 4: + case 5: + case 6: + System.out.println("你很棒"); + break; + default: + System.out.println("脑残"); + break; + } + count++; + System.out.println("你一共猜了" + count + "次"); + } + } +``` \ No newline at end of file -- Gitee