Input
Output
public class StarPattern { public static void main(String[] args) { // Manually assigned number of rows int rows = 5; System.out.println("Enter number of rows: " + rows); // Generate star pattern for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { System.out.print("* "); } System.out.println(); // Move to the next line after each row } } }