实训日记Day6(Java篇——用for循环语句实现从控制台输出乘法表)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/CNZSWYMP/article/details/86322007

第一种输出:

for (int i = 1; i < 10; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print(j+"*"+i+" ");
			}
			System.out.println();
		}

第二种输出:

for (int i = 9; i>0; i--) {
			for (int j = 1; j <= i; j++) {
				System.out.print(i+"*"+j+" ");
			}
			System.out.println();
		}

猜你喜欢

转载自blog.csdn.net/CNZSWYMP/article/details/86322007