# 20200710多重循环和跳转语句经典例题（图形，九九乘法表，输出星期几）

1.通过循环画出相应图形

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


public class Lianxi1 {
public static void main(String[] args) {
for(int i=1; i<=5;i++){
for (int k=1;k<=5-i;k++) {
System.out.print(" ");
}
for(int j=1;j<=5;j++){
System.out.print("*");
}
System.out.print("\n");
}
}
}


2.输出正，反九九乘法表

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


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


3.从键盘输入一位整数，当输入1-7，输出“星期一”~“星期日”；

public class Zuoye3{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
do {
System.out.println("请输入1-7之前的数字，输入0退出程序:");
int day = sc.nextInt();
if (day == 0) {
break;
} else if(day>0&&day<8){
switch (day) {
case 1:
System.out.println("星期一");
break;
case 2:
System.out.println("星期二");
break;
case 3:
System.out.println("星期三");
break;
case 4:
System.out.println("星期四");
break;
case 5:
System.out.println("星期五");
break;
case 6:
System.out.println("星期六");
break;
case 7:
System.out.println("星期七");
break;
}
break;
}else{
System.out.println("你输入的数字不合格");
}

}while(true);

}
}


12-06 33

09-16 2195
04-08 5035
12-07 1万+
03-20 1139
02-22 2115
07-20 7139
05-25 3044
05-27 3287
05-22 4259
03-17 1904
12-06 3112
07-19 2184
11-24 1919
08-27 2441
09-13 2557