#include <iostream>
using namespace std;

int main() {

    int row;
    cin>>row;
      
    for(int i=1;i<=row;i++)
        {
            int stars= i*2-1;
            int space = row-i;
            for(int j=1;j<=space;j++)
                {
                    cout<<" ";
                }
            for(int j=1;j<=stars;j++)
                {
                    cout<<"*";
                }
            cout<<endl;
       }
      for(int i=1;i<=row-1;i++)
        {
            int stars= 2*(row-i)-1;
            int space = i;
            for(int j=1;j<=space;j++)
                {
                    cout<<" ";
                }
            for(int j=1;j<=stars;j++)
                {
                    cout<<"*";
                }
            cout<<endl;
        }
    
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: