Bagaimana Anda mencetak pola bintang piramida terbalik berongga dengan python?

Di sini, dalam pencetakan pola ini, jumlah garis pola diambil sebagai input. Dua for loop digunakan untuk menampilkan pola. Perulangan for pertama (loop for luar) digunakan untuk menghitung nomor baris sehingga perulangan adalah dari 1 hingga n. bintang-bintang dicetak pada garis batas yang membuat polanya berlubang

Pada artikel ini, saya akan menunjukkan kepada Anda, Bagaimana menulis program C untuk mencetak rangkaian pola bintang piramida terbalik berongga n baris menggunakan for loop. Cara mencetak pola bintang piramida terbalik berongga di pemrograman C. Di sini, satu hal yang penting untuk diketahui yaitu deretan piramida

Program Logic to C untuk mencetak pola bintang piramida terbalik berongga

  • Masukkan nilai baris untuk segitiga sama sisi
  • Di sini saya telah menggunakan tiga loop, satu loop luar untuk mengubah garis dan dua loop dalam untuk mencetak bintang dan ruang
  • Loop luar mengulangi N kali dan mencetak baris baru setelah menyelesaikan loop dalam
  • Lingkaran dalam pertama cetak spasi x ke (N-1) (di mana N adalah nomor baris dan x adalah nomor baris saat ini)
  • Lingkaran dalam kedua mencetak bintang pada posisi ke-x atau kolom terakhir atau untuk baris pertama jika tidak maka akan mencetak ruang

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    20
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    21
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    22
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    25
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    26
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    28
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _2

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    32

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    35
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    21
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    22
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    38

    // CPP program to print a hollow pyramid pattern1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    40
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    42
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    43
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    45

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    48

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6#include <iostream>0
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    51
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    49
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    55
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    20
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    57
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    59

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    62
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    23
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    ____66 ___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

    #include <iostream>5

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    40
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    79
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    43
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    45

    // CPP program to print a hollow pyramid pattern1using0

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    85

    #include <iostream>5

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    40
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    42
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    43
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    45

    // CPP program to print a hollow pyramid pattern1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    15
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    15________2______26
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    15
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    23// CPP program to print a hollow pyramid pattern4

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    40
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    06
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    07

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    10

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    20
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    21
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    22
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    23
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    ______________________________________________________________________________________________________________________________________________________________________________________________________________

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    40
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    79
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    43
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    45

     

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _32

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _21
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    04

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _36

     

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _37

    C#




    using

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    39

    void5 void1 void2

     

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6void5 void6 void ________1______47

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    8

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    0

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6void6 void
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    5

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    9

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    2
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    3

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    // CPP program to print a hollow pyramid pattern1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    7

    // CPP program to print a hollow pyramid pattern1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1 // CPP program to print a hollow pyramid pattern0

    #include <iostream>5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    81// CPP program to print a hollow pyramid pattern3
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    // CPP program to print a hollow pyramid pattern1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    // CPP program to print a hollow pyramid pattern1// CPP program to print a hollow pyramid pattern8

    // CPP program to print a hollow pyramid pattern1#include <iostream>0 #include <iostream>1

    #include <iostream>5#include <iostream>3 #include <iostream>4

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    62
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    81#include <iostream>7
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    #include <iostream>5using0

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    62
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    81// CPP program to print a hollow pyramid pattern3
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    #include <iostream>5using6

    #include <iostream>5// CPP program to print a hollow pyramid pattern4

    // CPP program to print a hollow pyramid pattern1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    // CPP program to print a hollow pyramid pattern1namespace0

    // CPP program to print a hollow pyramid pattern_1

    // CPP program to print a hollow pyramid pattern1namespace3

    ________314

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _314_______16

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6namespace7

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1 std;0

    // CPP program to print a hollow pyramid pattern1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    81#include <iostream>7
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

     

    // CPP program to print a hollow pyramid pattern_33

    PHP




    // CPP program to print a hollow pyramid pattern_34

    // CPP program to print a hollow pyramid pattern_35

    // CPP program to print a hollow pyramid pattern_36

     

    // CPP program to print a hollow pyramid pattern_37

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    0// CPP program to print a hollow pyramid pattern39
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    61

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6// CPP program to print a hollow pyramid pattern43 // CPP program to print a hollow pyramid pattern44

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    3

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23// CPP program to print a hollow pyramid pattern51 // CPP program to print a hollow pyramid pattern52// CPP program to print a hollow pyramid pattern51 // CPP program to print a hollow pyramid pattern54// CPP program to print a hollow pyramid pattern39// CPP program to print a hollow pyramid pattern4// CPP program to print a hollow pyramid pattern_14_____

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    7

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23// CPP program to print a hollow pyramid pattern67
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    16// CPP program to print a hollow pyramid pattern51// CPP program to print a hollow pyramid pattern____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ jelas

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    // CPP program to print a hollow pyramid pattern1// CPP program to print a hollow pyramid pattern80 // CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6// CPP program to print a hollow pyramid pattern8

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6#include <iostream>0
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23// CPP program to print a hollow pyramid pattern43 // CPP program to print a hollow pyramid pattern92// CPP program to print a hollow pyramid pattern51 // CPP program to print a hollow pyramid pattern94

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    // CPP program to print a hollow pyramid pattern1#include <iostream>3

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23// CPP program to print a hollow pyramid pattern43 #include <iostream>01// CPP program to print a hollow pyramid pattern43 #include <iostream>03

    #include <iostream>_04// CPP program to print a hollow pyramid pattern51 #include <iostream>06

    #include <iostream>5// CPP program to print a hollow pyramid pattern80 #include <iostream>7// CPP program to print a hollow pyramid pattern4

    // CPP program to print a hollow pyramid pattern1using0

    #include <iostream>5// CPP program to print a hollow pyramid pattern80 // CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    // CPP program to print a hollow pyramid pattern1// CPP program to print a hollow pyramid pattern43#include <iostream>19

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6// CPP program to print a hollow pyramid pattern43 // CPP program to print a hollow pyramid pattern44

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6namespace3

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6// CPP program to print a hollow pyramid pattern80 #include <iostream>30// CPP program to print a hollow pyramid pattern4

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6namespace7

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    23// CPP program to print a hollow pyramid pattern51 // CPP program to print a hollow pyramid pattern44// CPP program to print a hollow pyramid pattern51 #include <iostream>43// CPP program to print a hollow pyramid pattern39 #include <iostream>45// CPP program to print a hollow pyramid pattern514

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6// CPP program to print a hollow pyramid pattern80 #include <iostream>7// CPP program to print a hollow pyramid pattern4

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

     

    #include <iostream>_57

    // CPP program to print a hollow pyramid pattern_39 #include <iostream>59

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    0// CPP program to print a hollow pyramid pattern39
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

     

    #include <iostream>_63

    #include <iostream>_64

    Javascript




    #include <iostream>_65

    #include <iostream>66#include <iostream>67

    #include <iostream>66#include <iostream>69

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    8

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    0

    #include <iostream>66// CPP program to print a hollow pyramid pattern37

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    36

    #include <iostream>66

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6#include <iostream>69
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    9

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    2
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    3

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    #include <iostream>_87

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    7

    #include <iostream>_87

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1 #include <iostream>91

    #include <iostream>87

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    // CPP program to print a hollow pyramid pattern1#include <iostream>95#include <iostream>96

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    #include <iostream>_87

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>_87

    #include <iostream>87// CPP program to print a hollow pyramid pattern8

    ________315

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    _315_______0 using05

    #include <iostream>87

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    // CPP program to print a hollow pyramid pattern1#include <iostream>3 #include <iostream>4

    #include <iostream>5#include <iostream>95#include <iostream>7

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    // CPP program to print a hollow pyramid pattern1using0

    #include <iostream>5#include <iostream>95#include <iostream>96

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    // CPP program to print a hollow pyramid pattern1using6

    #include <iostream>_87

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>87namespace0

    #include <iostream>87#include <iostream>95using29

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2namespace3

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    _6

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6namespace7

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1 using39

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    #include <iostream>87#include <iostream>95#include <iostream>7

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    6
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>_66

    #include <iostream>66using52

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6using54

    Keluaran

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########

    2. Berlian Berongga

    Catatan. Untuk input genap, cetak pola untuk n-1

    Contoh

    Memasukkan. 1

    Keluaran

    Bagaimana Anda mencetak pola bintang piramida terbalik berongga dengan python?

    Untuk n=1

    Memasukkan. 7

    Keluaran

    Bagaimana Anda mencetak pola bintang piramida terbalik berongga dengan python?

    Untuk n=7

    Memasukkan. 9

    Keluaran

    Bagaimana Anda mencetak pola bintang piramida terbalik berongga dengan python?

    Untuk n=9

     

    Mendekati. Untuk mencetak berlian, kita perlu mencetak spasi sebelum bintang dan setelah bintang untuk mencapai jarak bintang yang terus bertambah

    Untuk mencetak bentuk kotak kita perlu mencetak '-' untuk i==1 (baris pertama) & i==n (baris terakhir) dan '. ’ untuk j==1 (kolom pertama) dan j==n (kolom terakhir)

    Algoritma. 1. Jika n adalah kenaikan ganjil n

    2. Temukan pertengahan = n/2

    3. Lintasi dari 1 hingga pertengahan untuk mencetak separuh atas pola (katakanlah i)

    4. Lintasi dari 1 ke mid-i untuk mencetak spasi untuk kotak terluar paling kiri atas (katakanlah j)

    5. Jika (i==1) cetak '*' (karena untuk baris pertama kita hanya membutuhkan satu bintang)

    6. lain cetak '*' dan lintasi dari 1 ke 2*i-3 untuk mencetak spasi untuk berlian berongga (katakanlah j) dan cetak '*' setelah loop selesai

    7. Lintasi dari 1 ke mid-i untuk mencetak spasi lagi untuk kotak terluar paling kanan atas (katakanlah j)

    8. Tutup loop pada langkah 3

    9. Lintasi dari pertengahan+1 ke n-1 untuk mencetak separuh bawah pola (katakanlah i)

    4. Lintasi dari 1 ke i-mid untuk mencetak ruang untuk kotak terluar paling kiri bawah (katakanlah j)

    5. Jika (i==n-1) cetak '*' (karena untuk baris terakhir kita hanya membutuhkan satu bintang)

    6. lain cetak '*' dan lintasi dari 1 ke 2*(n-i)-3 untuk mencetak spasi untuk berlian berongga (katakanlah j) dan cetak '*' setelah loop selesai

    7. Lintasi dari 1 ke i-mid untuk mencetak spasi lagi untuk kotak terluar paling kanan bawah (katakanlah j)

    8. Tutup loop pada langkah 9

    C++14




    using_55

    using namespace std;

     

    using_59

    void

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1using63

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1 using67

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6#include <iostream>3using70using71

    #include <iostream>66using73

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6using75

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6using78

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1using81

    #include <iostream>_66

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1using84using85

    using86using87// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using_86

    ________315

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    _315_______3using93

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1using0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4namespace06

    using86

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1namespace09namespace10

    // CPP program to print a hollow pyramid pattern1// CPP program to print a hollow pyramid pattern2// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using86

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>_66

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1using84namespace26

    using86using87// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using_86

    #include <iostream>66namespace2

    namespace_34

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    namespace_34

    ________357

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _357_______38

    namespace_34

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1namespace41

    namespace_42

    #include <iostream>_66

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1namespace45using85

    using86using87// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using_86

    ________315

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    _315_______3namespace54

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1using0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4namespace06

    using86

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1namespace70namespace10

    // CPP program to print a hollow pyramid pattern1// CPP program to print a hollow pyramid pattern2// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using86

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    using86// CPP program to print a hollow pyramid pattern2using96// CPP program to print a hollow pyramid pattern4

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    #include <iostream>_66

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1namespace45namespace26

    using86using87// CPP program to print a hollow pyramid pattern3// CPP program to print a hollow pyramid pattern4

    using_86

    #include <iostream>66namespace2

    namespace_34

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

     

    namespace_98

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1 std;00

    namespace_34

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1 std;03

    namespace_34

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    0

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1

    std;_07

    Jawa




    std;_08

    void1 void2

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    _6

    using_59

    void6 void

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    5

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    1 using67

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6#include <iostream>3std;24
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    49std;_26
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    61using71

    #include <iostream>66using73

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6std;33
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    49// CPP program to print a hollow pyramid pattern4

    std;_36

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6using78

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    6
    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    27
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28std;43

    #include <iostream>_66

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1std;46
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28std;48using85

    using86

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    39// CPP program to print a hollow pyramid pattern3
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    #include <iostream>_87

    #include <iostream>66#include <iostream>3std;57

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28std;59

    using86

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    39using96
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2

    #include <iostream>66

       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *   
    1using0
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    5

    using86

         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    39using96
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    2namespace06

    using86

    -----*-----
    |   * *   |
    |  *   *  |
    | *     * |
    |*       *|
    *         *
    |*       *|
    | *     * |
    |  *   *  |
    |   * *   |
    -----*-----
    1std;46
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    28std;_364_______77
         #
        # #
       #   #
      #     #
     #       #
    #         #
    ###########
    49void54std;80std;81namespace_10

    Bagaimana Anda membalikkan pola bintang dengan Python?

    Program Python untuk Mencetak Pola Bintang Terbalik .
    Ambil nilai dari pengguna dan simpan dalam variabel n
    Gunakan perulangan for dimana nilai i berkisar antara nilai n-1 dan 0 dengan pengurangan 1 pada setiap iterasi
    Kalikan ruang kosong dengan n-i dan '*' dengan i dan cetak keduanya

    Bagaimana cara mencetak segitiga siku-siku berongga terbalik dengan Python?

    Deskripsi .
    # Ulangi baris. untuk i dalam rentang(1, n+1)
    # Ulangi kolom. untuk j dalam rentang(1, n+1)
    jika (i == j) atau (j == 1) atau (i == n). cetak("*", akhir=" ")
    kalau tidak. cetak(" ", akhir=" ")

    Bagaimana Anda mencetak pola segitiga berongga?

    scanf("%u",&baris);

    Bagaimana Anda membuat pola piramida dengan Python?

    Kode Sumber .
    Pertama, kami mendapatkan tinggi baris piramida dari pengguna
    Di loop pertama, kami beralih dari i = 0 ke i = baris
    Di loop kedua, kami mencetak angka mulai dari 1 hingga j , di mana j berkisar dari 0 hingga i
    Setelah setiap iterasi dari loop pertama, kami mencetak baris baru