趣味算法 一.九九乘法表

package test;

public class P1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

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

}

趣味算法 一.九九乘法表_第1张图片

 

格式微调整后-》

package test;

public class P1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		for(int i =1 ; i<=9 ; i++){
			for(int j=1 ; j<=i ; j++){
				//System.out.print(i + "x"+ j + "=" + (i*j) + "  ");
				System.out.print(j + "x"+ i + "=" + (i*j) + "\t");
			}
			System.out.println();
		}
	}

}

趣味算法 一.九九乘法表_第2张图片

你可能感兴趣的:(【趣味算法】,【架构与设计】)