Advertisement
desislava_topuzakova

Triangle of 55 stars

Jan 11th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class zadacha4 {
  2.     public static void main(String[] args) {
  3.         //начин 1
  4.         for (int i = 1; i <= 10; i++) {
  5.             System.out.println(repeatStr("*", i));
  6.  
  7.         }
  8.     }
  9.  
  10.     //начин 1
  11.     //System.out.println("*");
  12.     //System.out.println("**");
  13.     //System.out.println("***");
  14.     //System.out.println("****");
  15.     //System.out.println("*****");
  16.     //System.out.println("******");
  17.     //System.out.println("*******");
  18.     // System.out.println("********");
  19.     //System.out.println("*********");
  20.     // System.out.println("**********");
  21.  
  22.  
  23.     static String repeatStr(String str, int count) {
  24.         String text = "";
  25.         {
  26.             for (int j = 0; j < count; j++) {
  27.                 text = text + str;
  28.             }
  29.  
  30.         }
  31.         return text;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement