首页 > 其他 > 详细

复习程序流程控制语句

时间:2017-01-17 00:27:16      阅读:130      评论:0      收藏:0      [点我收藏+]

static void linXing() {
for (int i = 1; i <= 3; i++) {
for (int z = 1; z <= 3 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
for (int a = 2; a >= 1; a--) {
for (int b = 1; b <= 3 - a; b++) {
System.out.print(" ");
}
for (int c = 1; c <= a * 2 - 1; c++) {
System.out.print("*");
}
System.out.println();
}

}

static void zhengFangXin() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}

static void zhengSJX() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}

static void daoZhengSJX() {
for (int i = 4; i >= 1; i--) {
for (int j = 1; j <= i; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}

static void dengYaoSJX() {
for (int i = 1; i <= 4; i++) {
for (int z = 0; z <= 4 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}

static void daoDengYaoSJX() {
for (int i = 4; i >= 1; i--) {
for (int z = 0; z <= 4 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}

复习程序流程控制语句

原文:http://www.cnblogs.com/zhu5201314/p/6291236.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!