last time i was on here, the only question i needed help with in my computer science homework involved making a right triangle on 100 lines, here was the code for that:
public class PrintTriangle {
public static void main(String[] args) {
// Print a right triangle made up of *
// starting at 100 and ending with 1
int i = 100;
while (i > 0) {
for (int j = 0; j < i; j++)
System.out.print("*");
System.out.println();
i--;
}
}
}
well now he's asked us to do the inverse. here's the actual question:
"Write a program that will draw a right triangle of 100 lines in the following shape: The first line, print 100 '', the second line, 99 '’... the last line, only one '*'. Using for loop for this problem. Name the program as PrintTriangle.java"
*****
****
***
**
*
i'm sure it's something simple but everything i've tried up to this point has flopped or only created 1 space at a time. any suggestions or help would be greatly appreciated! thank you in advance!