标签:i+1 print generate png while循环 myeclipse method 效果图 es2017
效果图如下图所示:
1 package myeclipseFiles2; 2 3 public class Rhombus { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 int i=1; 8 while(i<=4){ 9 int j=1; 10 //先打印出前i+1个数 11 while(j<=i+3){ 12 //判断打印的数中前几个数应该是打印空格 13 if(j<=4-i){ 14 System.out.print(" "); 15 }else{ 16 System.out.print("*"); 17 } 18 j++; 19 } 20 System.out.println(); 21 i++; 22 } 23 int i1=1; 24 while(i1<=3){ 25 int j1=1; 26 while(j1<=7-i1){ 27 if(j1<=i1){ 28 System.out.print(" "); 29 }else{ 30 System.out.print("*"); 31 } 32 j1++; 33 } 34 System.out.println(); 35 i1++; 36 } 37 } 38 39 }
标签:i+1 print generate png while循环 myeclipse method 效果图 es2017
原文地址:http://www.cnblogs.com/ztt0918/p/7997690.html