Just small change in your code-
public static void main(String[] args) {
int i = -1;
for (int j = 0; j < 11; j += 2) {
i++;
for (int k = i; k < 5; k++) //small change
System.out.print(" "); //small change
for (int z = 0; z <= j; z++) {
System.out.printf("%d", i);
}
System.out.println();
}
}
1
solved i want this program to print the numbers in triangle shape [closed]