题解 | #直角三角形图案#

直角三角形图案

http://www.nowcoder.com/practice/00dd93f7c7074754b7511bf56d1f15ac

import java.util.Scanner;
import java.util.Collections;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()) {
            int num = scan.nextInt();
            for(int i = 0; i < num; i++) {
                System.out.println(String.join(" ", Collections.nCopies(i + 1, "*")));
            }
            
        }
    }
}
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务