dd

di
mail@pastecode.io avatar
unknown
java
a year ago
1.6 kB
1
Indexable
Never
package PAC1;

import java.util.Scanner;

public class C4
{
    public static void main(String[] args)
    {
        {
            Scanner sc=new Scanner(System.in);
            int number = sc.nextInt();
            int m, n;
            for (m = 1; m <= number; m++)
            {
                for (n = 1; n <= number - m; n++)
                {
                    System.out.print(" ");
                }

                for (n = 1; n <= m * 2 - 1; n++)
                {
                    System.out.print("*");
                }
                for (n = 1; n <= number*2 - m*2; n++)
                {
                    System.out.print(" ");
                }

                for (n = 1; n <= m * 2 - 1; n++)
                {
                    System.out.print("*");
                }

                System.out.println();
            }
            for (m = number - 1; m > 0; m--)
            {

                for (n = 1; n <= number - m; n++)
                {
                    System.out.print(" ");
                }

                for (n = 1; n <= m * 2 - 1; n++)
                {
                    System.out.print("*");
                }
                for (n = 1; n <= number*2 - m*2; n++)
                {
                    System.out.print(" ");
                }

                for (n = 1; n <= m * 2 - 1; n++)
                {
                    System.out.print("*");
                }

                System.out.println();
            }
        }
    }
}