package com.pzhu.examples;
import java.util.Scanner;
public class Triangle {
//Java编程:实现控制台输入一个整数n,输出如下图形?
/**
* *
* ***
* *****
* *******
* *********
*/
public static void main(String[] args) {
System.out.println("请输入正整数n");
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
for (int i = 1; i <= n; i++) {
for (int j = 0; j < n - i; j++) {
System.out.print(" ");
}
for (int k = 0; k < 2 * i - 1; k++) {
System.out.print("*");
}
System.out.println();
}
}
}