题解 | #翻转金字塔图案#

翻转金字塔图案

https://www.nowcoder.com/practice/c4775776e4464537bfb6a5ba37c596c6

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            for (int i = 1 ; i <= n; i++) {
                for (int j = 1; j < i; j++) {
                    System.out.print(" ");
                }
                for (int z = i; z <= n; z++) {
                    System.out.print("* ");
                }
                System.out.println();
            }
        }
    }
}

全部评论

相关推荐

牛客246576843号:建议简历对点优化,想做HR专门列出HR实习,想做运营专门列出运营实习,并且对点写出项目经历以及数据,同时在个人总结上可以多凸出和岗位的匹配度
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务