I need to to write a method that is called like printTriangle(5);. We need to create an iterative method and a recursive method (without ANY iteration). The out
printTriangle(5);
I think this should work... untested off the top of my head.
public void printTriangle(int count) { if (count == 0) return; printTriangle(count - 1); for (int x = 1; x <= count; x++) { System.out.print("*"); } System.out.print("\n"); }