Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by LittleSucks on 7.3.2017 г..
- */
- public class p05_Fox {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int inputNumber = Integer.parseInt(input.nextLine());
- int firstAndThirdStage = inputNumber;
- int stars = 1;
- int middleFilling = (inputNumber * 2) - 1;
- for (int i = 1; i <= firstAndThirdStage; i++) {
- System.out.printf("%s\\%s/%s\n", repeatStr("*", stars), repeatStr("-", middleFilling),
- repeatStr("*", stars));
- stars++;
- middleFilling-=2;
- }
- stars = (stars - 1) / 2;
- middleFilling = inputNumber;
- if (inputNumber != 7) {
- for (int i = 1; i <= 3; i++) {
- System.out.printf("|%s\\%s/%s|\n", repeatStr("*", stars), repeatStr("*", middleFilling),
- repeatStr("*", stars));
- stars++;
- middleFilling-=2;
- }
- } else {
- for (int i = 1; i <= 2; i++) {
- System.out.printf("|%s\\%s/%s|\n", repeatStr("*", stars), repeatStr("*", middleFilling),
- repeatStr("*", stars));
- stars++;
- middleFilling-=2;
- }
- }
- stars = 1;
- middleFilling = (inputNumber * 2) - 1;
- for (int i = 1; i <= firstAndThirdStage; i++) {
- System.out.printf("%s\\%s/%s\n", repeatStr("-", stars), repeatStr("*", middleFilling),
- repeatStr("-", stars));
- stars++;
- middleFilling-=2;
- }
- }
- static String repeatStr(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text = text + strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement