Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Program {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n = input.nextInt();
- for (int i = 0; i <= n/2; i++) {
- String dots = new String(new char[i]).replace("\0", ".");
- String stars = new String(new char[n - 2 * i]).replace("\0", "*");
- System.out.printf("%s%s%s", dots, stars, dots);
- System.out.println();
- }
- for (int i = n/2 - 1; i >= 0; i--) {
- String dots = new String(new char[i]).replace("\0", ".");
- String stars = new String(new char[n - 2 * i]).replace("\0", "*");
- System.out.printf("%s%s%s", dots, stars, dots);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement