If I want to print the pattern below, and I have an Array:
*******
*****
***
*
***
*****
*******
This is what I have so far:
public static void main(String[] args) {
int[] p = {7,5,3,1,3,5,7};
for (int i=0; i <= 7; i++) {
System.out.print("\n");
for (int k =i; k <= 7; k++) {
k = p[i];
// I'm trying to find a way to print "*"s with array element value
for(int j=i; j <= 7; j++) {
System.out.print("*");
}
}
}
}
I definitely went wrong somewhere, and I apologize for my ignorant. I'm just trying to learn. Thanks!
stars = 7thenspaces = 0. when stars are reduced by 2, spaces are increased by one. until stars are 1, then reverse.