# 一、代码及效果图

## 1.阶乘

import java.util.Scanner;
public class Work2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个整数n：");
int n = sc.nextInt();
int sum=1;
for (int i=n;i>=1;i--){
sum*=i;
}
System.out.println("n的阶乘结果为："+sum);
}
}



## 2. 99乘法表

public class Work3 {
public static void main(String[] args) {
for (int i = 1; i <=9 ; i++) {
for (int j = 1; j <=i ; j++) {
System.out.print(i+"*"+j+"="+i*j+"\t");
}
System.out.println("\n");
}
}
}



## 3.水仙花

public class Work03 {
public static void main(String[] args) {
System.out.println("所有水仙花数为：");
for (int i = 100; i <=999 ; i++) {
int ge = i%10;
int shi = i/10%10;
int bai = i/100;
if (ge*ge*ge+shi*shi*shi+bai*bai*bai==i){
System.out.println(i);
}
}
}
}


## 4.循环接收学生成绩

import java.util.Scanner;
public class Work06 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int isGoing;
int sum=0;//记录总分
double count=0;//计数器，记录学员个数
do {
System.out.println("请输入学员的成绩：");
sum+=sc.nextDouble();
System.out.println("是否继续：（1表示继续）");
isGoing = sc.nextInt();
count++;
}while (isGoing==1);
System.out.println("总分："+sum);
System.out.println("平均分："+sum/count);
}
}


## 5.猜字小游戏

import java.util.Scanner;
public class Work08 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int target=8;
System.out.println("请输入你想猜的数字0-10之间：");
for (int i = 1; i <=5; i++) {
int number = sc.nextInt();
if (i == 5 && number!=target) {//第五次还没猜对
System.out.println("真笨，不和你玩了");
}
if (number>target && i<=4) {
System.out.println("大了，继续猜");
} else if (number<target && i<=4) {
System.out.println("小了，继续猜");
} else if (number == target) {
System.out.println("你真聪明，猜对了");
break;
}
}
}
}



02-04

07-10 266
04-11 527
01-08 55
02-01 282
08-27 608
04-14 1万+
06-14 572
05-08 58
08-02 2463
01-04
09-19