1. 程式人生 > >使用嵌套while循環輸出10行10列的星號

使用嵌套while循環輸出10行10列的星號

log post brush 循環輸出 gpo == print system div

//while-if嵌套
		/*char n=‘*‘;
		int m=1;
		System.out.println("==輸出10行10列的星號==");
		while(m<101){
			System.out.print(n+" ");
			if(m%10==0){
				System.out.println();	
			}
			m++;
			*/

  

//while-while嵌套循環
		int m=1;
		int n=1;
		while(m<=10){
			while(n<10){
				System.out.print("* ");
				n++;
			}
			n=1;
			System.out.println("* ");
			m++;

  

使用嵌套while循環輸出10行10列的星號