资源限制
时间限制:1.0s 内存限制:512.0MB
问题描述
编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
* * * * *
* * * *
* * *
* *
*
import java.util.Scanner;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int x=n;x>0;x--) {
for(int y=x;y>0;y--) {
if(y==1)
System.out.print("*");
else
System.out.print("* ");
}
System.out.println();
}
}
}