Java实现三角形图案绘制**
Java实现如下图形: / / * / * * * * * * * *
import java
.util
.Scanner
;
public class Xingxing
{
public static void main(String
[] args
)
{
Scanner sc
=new Scanner(System
.in
);
int n
=sc
.nextInt();
for(int i
=1;i
<=n
;i
++)
{
for(int j
=i
;j
<=n
;j
++)
{
System
.out
.print(" ");
}
for(int k
=1;k
<=2*i
-1;k
++)
System
.out
.print("*");
System
.out
.println();
}
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-8239.html