码迷,mamicode.com
首页 > 其他好文 > 详细

复习程序流程控制语句

时间:2017-01-17 00:29:39      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:语句   oid   dao   ++   复习   linx   for   stat   程序流程控制   

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();
}
}

复习程序流程控制语句

标签:语句   oid   dao   ++   复习   linx   for   stat   程序流程控制   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!