集册 Java实例教程 为给定数字生成金字塔

为给定数字生成金字塔

欢马劈雪     最近更新时间:2020-01-02 10:19:05

676
为给定数字生成金字塔


import java.io.BufferedReader;

import java.io.InputStreamReader;

 //时代Java公众号 - N o w J a  v a . c o m 提供

public class Main {

       

        public static void main (String[] args) throws Exception{

               

                BufferedReader keyboard = new BufferedReader (new InputStreamReader (System.in));

               

                System.out.println("Enter Number:");

                int as= Integer.parseInt (keyboard.readLine());

                System.out.println("Enter X:");

                int x=   Integer.parseInt (keyboard.readLine());

                 //来自 N o w J a v a . c o m

                int y = 0;

               

                for(int i=0; i<= as ;i++){

                       

                        for(int j=1; j <= i ; j++){

                                System.out.p
展开阅读全文