首页 > 编程语言 >打印九九乘法表,打印金字塔-java

打印九九乘法表,打印金字塔-java

时间:2022-09-25 19:59:28浏览次数:55  
标签:九九乘法 java int 打印 金字塔 public

/**
  *
 ***
*****
打印如图金字塔
*=i*2-1

(竖)空格数=列数-1
*/
public class Circulate{
	public static void main(String[] args){
		int count = 3;
		for (int i = 1; i <= count; i++) {
			//控制打印空格次数
			for (int j = i; j <= count; j++) {
				System.out.print(" ");
			}
			//控制打印*次数
			for (int c = 0; c < 2*i-1; c++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
}

标签:九九乘法,java,int,打印,金字塔,public
From: https://www.cnblogs.com/xiaoto9426/p/16728621.html

相关文章