Advertisement
xapu

Untitled

Jun 3rd, 2017
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1.  
  2. import com.sun.org.apache.xpath.internal.SourceTree;
  3.  
  4. import java.util.Scanner;
  5.  
  6. /**
  7.  * Created by Asus on 03/06/2017.
  8.  */
  9. public class test {
  10.     public static void main(String[] args) {
  11.         Scanner koce = new Scanner(System.in);
  12.  
  13.         String mykey = "*";
  14.         int n = Integer.parseInt(koce.nextLine());
  15.  
  16.         for(int i = n-1; i>0; i--){
  17.             System.out.print(printer(" ",i));
  18.             System.out.print(printer("* ", n-i));
  19.             System.out.println();
  20.         }
  21.  
  22.         for(int i = 0; i<n; i++){
  23.             System.out.print(printer(" ",i));
  24.             System.out.print(printer("* ", n-i));
  25.             System.out.println();
  26.         }
  27.  
  28.         printer(mykey,n);
  29.     }
  30.  
  31.     private static String printer(String mykey, int n) {
  32.  
  33.         String result = "";
  34.  
  35.         for(int i =0; i<n; i++){
  36.             result+=mykey;
  37.         }
  38.  
  39.         return result;
  40.  
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement