Java控制台打印九九乘法表和杨辉三角形

package traning.multiplicative;

/**
 * 
 * @author cloud
 *
 */

public class MultiplicativeTable {

	/**
	 * 九九乘法表
	 */
	public static void printMultiplicativeTable(){
		for (int i = 1; i < 10; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print(i + " * " + j + " = " + (i * j) + "\t");
			}
			System.out.println();
		}
	}
	
	/**
	 * 打印杨辉三角形
	 */
	public static void printTrigon(){
	    int[][] a = new int[10][10];
	    for(int i = 0; i < 10; i++) {
	    	a[i][i] = 1;
	    	a[i][0] = 1;
	    }
	    for(int i=2; i<10; i++) {
	    	for(int j=1; j

你可能感兴趣的:(Java)