1. 编写一个java程序,实现以下图形。 * ** *** **** *****
时间: 2023-10-06 17:09:55 浏览: 69
Sure, here's a Java program that will print the requested pattern:
```java
public class PatternProgram {
public static void main(String[] args) {
int rows = 5;
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= rows - i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= i; k++) {
System.out.print("*");
}
System.out();
}
}
}
```
This program uses nested loops to print the pattern. The outer loop is responsible for iterating through the rows, while the inner loops print the spaces and asterisks. The number of rows is set to 5 in this example, but you can change it to any desired value. When you run this program, it will display the pattern as follows:
```
*
**
***
****
*****
```
Please let me know if you need any further assistance!