A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

菜鸟虽菜   也想飞
  1. class Work6 {
  2.         public static void main(String[] args) {
  3.                 for (int i =1;i <= 4 ;i++ ) {
  4.                         for (int j = 1; j <=7 ;j++ ) {
  5.                                 if ((i +3) ==j) {
  6.                                         System.out.print("*");
  7.                                 }else {
  8.                                         System.out.print(" ");
  9.                                 }
  10.                                 if ((i+1) ==j&&j!=2) {
  11.                                         System.out.print("*");
  12.                                 }else {
  13.                                         System.out.print(" ");
  14.                                 }
  15.                                 if ((i-1) ==j&&j!=1) {
  16.                                         System.out.print("*");
  17.                                 }else{
  18.                                     System.out.print(" ");
  19.                                 }
  20.                                 if ((i-3)==j) {
  21.                                         System.out.print("*");
  22.                                 }else{
  23.                                     System.out.print(" ");
  24.                                 }
  25.                                
  26.                         }
  27.                         System.out.println();
  28.                 }
  29.                
  30.         }
  31. }
复制代码

1 个回复

正序浏览
虽然出来的  但感觉 怪怪滴
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马