what changes can get me a pyramid of stars in this code?
chanbhatia (0)

import java.util.Scanner;
class Main {
static int i , j , row;
public static void pyramidPattern(int row) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter number of Rows");
row = sc.nextInt();
for ( i = 0; i <row; i++) {
System.out.print(" ");
for ( j = 0; j <=i; j++) {
System.out.print("* ");
}
System.out.println();
}
}
public static void main(String args[]){
pyramidPattern(row);
}
}

You are viewing a single comment. View All
ArchieMaclean (589)

@chanbhatia There should be an option on this page to mark one of the answers as correct? Make sure you're logged in/refresh?