OpKaTa

MENTORMATE

Feb 11th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LastShance {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scan.nextLine());
  8.  
  9. int lines = ((n-1)/2);
  10.  
  11. int startEndLines = n;
  12. int firstStar = n;
  13. int midMinus=n;
  14. String minus ="-";
  15. String stars= "*";
  16.  
  17. for (int i = 1; i <=lines ; i++) {
  18. startEndLines -=1;
  19. firstStar +=2;
  20. midMinus -=2;
  21. for (int colum = 1; colum <=2; colum++) {
  22.  
  23. for (int j = 1; j <= startEndLines; j++) { //purvite minusi
  24. System.out.print(minus);
  25. }
  26. for (int j = 1; j <=firstStar; j++) {
  27. System.out.print(stars);
  28. }
  29. for (int j = 1; j <=midMinus; j++) {
  30. System.out.print(minus);
  31. }
  32. for (int j = 1; j <=firstStar ; j++) {
  33. System.out.print(stars);
  34. }
  35. for (int j = 1; j <=startEndLines ; j++) {
  36. System.out.print(minus);
  37. }
  38.  
  39. }
  40. System.out.println();
  41.  
  42. }
  43.  
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment