Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Fox {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- int n = Integer.parseInt(console.nextLine());
- int stars = 0;
- int dashes = (2 * n) + 1;
- int stars1 = (2 * n) + 1;
- int dashes1 = 0;
- int middleStars = n;
- int endStars = (n - 1)/2;
- for (int i = 0; i < n ; i++) {
- stars = stars + 1;
- dashes = dashes - 2;
- System.out.printf("%s\\%s/%s\n", repeatStr("*", stars),
- repeatStr("-", dashes), repeatStr("*", stars));
- }
- for (int j = 0; j < n / 3; j++) {
- System.out.printf("|%s\\%s/%s|\n", repeatStr("*", endStars),
- repeatStr("*", middleStars), repeatStr("*", endStars));
- endStars = endStars + 1;
- middleStars = middleStars - 2;
- }
- for (int y = 0; y < n; y++) {
- stars1 = stars1 - 2;
- dashes1 = dashes1 + 1;
- System.out.printf("%s\\%s/%s\n", repeatStr("-", dashes1),
- repeatStr("*", stars1), repeatStr("-", dashes1));
- }
- }
- 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