1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
-
-
- public class TriangleUtilities {
-
- public static String getRow(int numberOfStars) {
- String output = "";
- for(int i=0; i < numberOfStars; i++) {
- output = output + "*";
- }
- return output;
- }
-
- public static String getTriangle(int numberOfRows) {
- String results = "";
- for(int i=0; i< numberOfRows; i++) {
- for(int j=0; j<=i; j++) {
- results = results + "*";
- }
- results = results + "\n";
- }
- return results;
- }
-
-
- public static String getSmallTriangle() {
- String results = "";
- for (int i=0; i<4; i++) {
- for (int j=0; j<=i; j++){
- results = results + "*";
- }
- results = results +"\n";
- }
- return results;
- }
-
- public static String getLargeTriangle() {
- String results = "";
- for (int i=0; i<9; i++) {
- for (int j=0; j<=i; j++){
- results = results + "*";
- }
- results = results +"\n";
- }
- return results;
- }
- }
|