Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class LastShance {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- int lines = ((n-1)/2);
- int startEndLines = n;
- int firstStar = n;
- int midMinus=n;
- String minus ="-";
- String stars= "*";
- for (int i = 1; i <=lines ; i++) {
- startEndLines -=1;
- firstStar +=2;
- midMinus -=2;
- for (int colum = 1; colum <=2; colum++) {
- for (int j = 1; j <= startEndLines; j++) { //purvite minusi
- System.out.print(minus);
- }
- for (int j = 1; j <=firstStar; j++) {
- System.out.print(stars);
- }
- for (int j = 1; j <=midMinus; j++) {
- System.out.print(minus);
- }
- for (int j = 1; j <=firstStar ; j++) {
- System.out.print(stars);
- }
- for (int j = 1; j <=startEndLines ; j++) {
- System.out.print(minus);
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment