一叶追寻
public class Prog {
public static void main(String[] args) {
//99乘法表
for(int y=1;y<=9;y++){
for(int x =1;x<=y;x++){
System.out.print(x+"*"+y+"="+x*y+"\t");
}
System.out.println();
}
System.out.println();
//打印菱形
int n = 5;//改变菱形大小
// 打印上半部分
for (int i = 0; i
for (int j = 0; j
if (j
System.out.print(" ");
if (j >= n - i && j <= n + i)
System.out.print("*");
}
System.out.println();
}
// 打印下半部分
for (int i = 1; i
System.out.print(" ");
for (int j = 0; j
if (j
System.out.print(" ");
if (j >= i && j
System.out.print("*");
}
System.out.println();
}
}
}运行结果如图所示