123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
-
-
- public class TriangleUtilities {
-
- public static String getRow(int numberOfStars) {
- StringBuilder anw = new StringBuilder();
- for(int i=0;i<numberOfStars;i++){
- anw.append("*");
-
- }
- return anw.toString();
- }
-
- public static String getTriangle(int numberOfRows) {
- StringBuilder anw = new StringBuilder();
- for (int i=1;i<numberOfRows+1;i++){
- for(int j=0;j<i;j++){
- anw.append("*");
-
- }
- anw.append("\n");
- }
- return anw.toString();
- }
-
-
- public static String getSmallTriangle() {
- StringBuilder anw = new StringBuilder();
- for (int i=1;i<3;i++){
- for(int j=0;j<i+1;j++){
- anw.append("*");
- }
- anw.append("\n");
- }
- return anw.toString();
- }
-
- public static String getLargeTriangle() {
- StringBuilder anw = new StringBuilder();
- for (int i=1;i<10;i++){
- for(int j=0;j<i+1;j++){
- anw.append("*");
- }
- anw.append("\n");
- }
-
-
- return anw.toString();
- }
- }
|