1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import java.util.Scanner;
public class Xinghua {
public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); while(s.hasNext()) //实现多组样例输入 { int n=s.nextInt(); //输入 for(int i=1;i<=n;i++) //换列 { for(int j=0;j<n-i;j++) System.out.print(" "); for(int k=n-i;k<n;k++) System.out.print("* "); System.out.println(); } } }
}
|