/** */ /** * FanlikeEquilateralTriangle.java * 打印一个扇状正三角形 * @author 邓超(CodingMouse) * @version 0.1 2008-5-6 * 开发/测试环境:jdk1.6 + eclipse SDK 3.3.2 */ public class FanlikeEquilateralTriangle ... { public static void main(String[] args) ...{ //扇状三角形层数 int border = 10; for (int i = 1 ; i <= border ; i++) ...{ for (int j = border - 1 ; j >= i ; j--) ...{ System.out.print(" "); } for (int k = 1 ; k <= i + 1 ; k++) ...{ if (k % 2 == 0) ...{ System.out.print("* "); } else ...{ System.out.print(" "); } } System.out.println(); } }}