📌  相关文章
📜  System.out.printf("%"+(n)+"s \n") - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:37.163000             🧑  作者: Mango

代码示例1
public class Staircase {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String str = "#";
        for (int i = 0; i < n; i++) {
            System.out.printf("%" + (n) + "s \n", str);
            str += "#";
        }
        in.close();
    }
}