How do I display the following?
Hey guys,
I know there's a for loop involved in this, but how do I display the following output?
*
**
***
****
*****
******
*******
********
********
**********
In case you have a hard time counting the stars, it's from 1-10 respectively.Any help would be appreciated. Thanks.
Here you go:
public class test {
public static void main(String args[]) {
int i = 0;
StringBuffer buf = new StringBuffer("");
while (i < 10) {
buf.insert(0, "*");
String star = buf.toString();
System.out.println(star);
i++;
}
}
}
> What does that have to do with the question I'm> asking?It clearly shows that if people give you code, you get your homework done, but only to fail at the next task, because you don't bother to understand what the code does.