Advertisement
Dilyana86

Untitled

Apr 14th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class kingOfThieves260415m {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. int n = Integer.parseInt(scan.nextLine());
  7. String symbol = scan.nextLine();
  8.  
  9. int tire = n / 2;
  10. int count = 1;
  11.  
  12. for (int i = 0; i < n; i++){
  13. System.out.println(doMagic("-", tire) + doMagic(symbol, count) + doMagic("-", tire));
  14. if (i < n / 2){
  15. tire--;
  16. count += 2;
  17. }else{
  18. tire++;
  19. count -= 2;
  20. }
  21. }
  22. }
  23. static String doMagic(String strToRepeat, int count) {
  24. String text = "";
  25.  
  26. for (int i = 0; i < count; i++) {
  27. text = text + strToRepeat;
  28. }
  29.  
  30. return text;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement