123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
-
- public class TriangleUtilities {
- public static String getRow(int numberOfStars) {
- String result= "";
- for(int i=0; i<numberOfStars; i++) {
- result+= "*";
- }
-
- return result;
- }
-
- public static String getTriangle(int numberOfRows) {
- String triangle="";
- for(int i=1; i<=numberOfRows; i++) {
- for(int z=1; z<=i; z++){
- triangle += "*";
-
- }
- triangle+="\n";
-
- }
-
- return triangle;
- }
-
- public static String getSmallTriangle() {
- String triangle="";
- for(int i=1; i<=4; i++) {
- for(int z=1; z<=i; z++){
- triangle += "*";
-
- }
- triangle+="\n";
-
- }
-
- return triangle;
- }
-
- public static String getLargeTriangle() {
- String triangle="";
- for(int i=1; i<=9; i++) {
- for(int z=1; z<=i; z++){
- triangle += "*";
-
- }
- triangle+="\n";
-
- }
-
- return triangle;
- }
- }
|