java吧 关注:1,227,743贴子:12,688,109
  • 22回复贴,共1


来自Android客户端1楼2015-10-26 10:27回复
    哪个学校,还在教applet


    IP属地:广东3楼2015-10-26 10:47
    收起回复
      x是菱形的边长


      IP属地:浙江来自iPhone客户端4楼2015-10-26 12:38
      收起回复
        下面给你吃


        来自Android客户端5楼2015-10-26 12:40
        收起回复
          .······································.......哦


          IP属地:福建6楼2015-10-26 13:28
          收起回复
            这个不难吧


            IP属地:江苏来自Android客户端7楼2015-10-26 13:59
            收起回复
              下面有什么好看的


              IP属地:广东来自Android客户端8楼2015-10-26 14:01
              收起回复
                我还以为是控制台输出


                IP属地:广东9楼2015-10-26 14:36
                收起回复
                  public static void main(String[] args) {
                  int n = 5; //边长
                  for (int i = 1; i <= n; i++) {
                  for (int j = 1; j <= 2 * n - 1; j++) {
                  if (Math.abs(j - n) > (i - 1)) {
                  System.out.print(" ");
                  } else {
                  System.out.print("*");
                  }
                  }
                  System.out.println();
                  }
                  for (int i = n-1; i > 0; i--) {
                  for (int j = 2 * n - 1; j >0; j--) {
                  if (Math.abs(j - n) > (i -1)) {
                  System.out.print(" ");
                  } else {
                  System.out.print("*");
                  }
                  }
                  System.out.println();
                  }
                  }


                  IP属地:江苏10楼2015-10-26 14:52
                  收起回复
                    修改版~~更好看
                    public class MainDemo2 {
                    public static void main(String[] args) {
                    int n = 5; //边长
                    for (int i = 1; i <= n; i++) {
                    for (int j = 1; j <= 2 * n - 1; j++) {
                    if (Math.abs(j - n) > (i - 1)) {
                    System.out.print(" ");
                    } else {
                    System.out.print(" * ");
                    }
                    }
                    System.out.println();
                    }
                    for (int i = n-1; i > 0; i--) {
                    for (int j = 2 * n - 1; j >0; j--) {
                    if (Math.abs(j - n) > (i -1)) {
                    System.out.print(" ");
                    } else {
                    System.out.print(" * ");
                    }
                    }
                    System.out.println();
                    }
                    }
                    }


                    IP属地:江苏11楼2015-10-26 14:56
                    收起回复