| 8 | */ |
| 9 | class ForForDemo2 { |
| 10 | public static void main(String[] args) { |
| 11 | //���������һ��5��5�е����� |
| 12 | /* |
| 13 | for(int x=0; x<5; x++) { |
| 14 | for(int y=0; y<5; y++) { |
| 15 | System.out.print("*"); |
| 16 | } |
| 17 | System.out.println(); |
| 18 | } |
| 19 | */ |
| 20 | |
| 21 | //������������Ҫ�����°벿�� |
| 22 | //ͨ���۲�ͼ�Σ�����֪����û�б仯�������ڱ仯 |
| 23 | //��һ�У�1�� |
| 24 | //�ڶ��У�2�� |
| 25 | //������3�� |
| 26 | //������4�� |
| 27 | //������5�� |
| 28 | //��Ȼ��һ���仯��������ô���ǾͶ���һ������ |
| 29 | /* |
| 30 | int z = 0; |
| 31 | for(int x=0; x<5; x++) { |
| 32 | for(int y=0; y<=z; y++) { |
| 33 | System.out.print("*"); |
| 34 | } |
| 35 | System.out.println(); |
| 36 | z++; |
| 37 | } |
| 38 | */ |
| 39 | |
| 40 | //���Ƿ���z�ı仯��x�ı仯��ʵ��һ�µ� |
| 41 | //�������Ǹ�����û�б�Ҫ����z������ֱ�Ӱ�z��x�滻 |
| 42 | for(int x=0; x<5; x++) { |
| 43 | for(int y=0; y<=x; y++) { |
| 44 | System.out.print("*"); |
| 45 | } |
| 46 | System.out.println(); |
| 47 | } |
| 48 | System.out.println("---------"); |
| 49 | |
| 50 | for(int x=1; x<=5; x++) { |
| 51 | for(int y=1; y<=x; y++) { |
| 52 | System.out.print("*"); |
| 53 | } |
| 54 | System.out.println(); |
| 55 | } |
| 56 | } |
| 57 | } |