java用*号打印金字塔

/*
	功能:用*号打印金字塔
*/

import java.io.*;
public class  Demo
{
	public static void main(String[] args) 
	{
		Dayin dayin=new Dayin();
		dayin.Dayin();
	}
}

class Dayin
{
	public void Dayin()
	{
		try
		{
			BufferedReader br;
			br = new BufferedReader(new InputStreamReader(System.in));
			System.out.println("请输入金字塔层数:");
			String ceng1=br.readLine();
			int ceng = Integer.parseInt(ceng1);

			for (int i=0;i

运行效果:

java用*号打印金字塔_第1张图片

你可能感兴趣的:(Java)