I'm kinda in a rush here so my problem here is this:
You have to make a staircase with n lines and k stars, with k increasing k times each time. (Also add a period on each line to start with)
The staircase should be right-situated like this:
. *
. **
. ***
.****
The function given is
printStairs(int n, int k) {
}
And so far my code is this:
void printStairs(int n, int k) {
for (int i = 0; i < n; i += k) {
print(".");
for (int j = 0; j < n; j++) {
if (j < n - i - k) {
print(" ");
} else {
print("*");
}
}
println();
}
}
Can someone help?