C++ Program to Print Hollow Left Pascals Star Triangle

Write a C++ program to print the hollow left pascals star triangle pattern using for loop. 

#include<iostream>
using namespace std;

int main()
{
	int i, j, k, rows;
     
    cout << "Enter Hollow Left Pascals Star Triangle Row = ";
    cin >> rows;

    cout << "Hollow Left Pascals Star Triangle Pattern\n"; 

    for(i = 1; i <= rows; i++)
    {
    	for(j = rows; j > i; j--)
		{
            cout << " ";
        }
        for(k = 1; k <= i; k++)
        {
            if(k == 1 || k == i)
            {
                cout << "*";
            }
            else
            {
                cout << " ";
            }       
        }
        cout << "\n";
    }	

    for(i = 1; i <= rows - 1; i++)
    {
    	for(j = 1; j <= i; j++)
		{
            cout << " ";
        }
        for(k = rows - 1; k >= i; k--)
        {
            if(k == rows - 1 || k == i)
            {
                cout << "*";
            }
            else
            {
                cout << " ";
            } 
        }
        cout << "\n";
    }
 	return 0;
}
CPP Program to Print Hollow Left Pascals Star Triangle

This C++ example prints the hollow left pascals triangle of a given character using a while loop.

#include<iostream>
using namespace std;

int main()
{
	int i = 1, j, k, rows;
    char ch;

    cout << "Enter Hollow Left Pascals Star Triangle Row = ";
    cin >> rows;

    cout << "Enter Symbol for Hollow Left Pascals Triangle = ";
    cin >> ch;

    cout << "Hollow Left Pascals Star Triangle Pattern\n"; 

    while(i <= rows)
    {
        j = rows;
    	while( j > i)
		{
            cout << " ";
            j--;
        }
        k = 1;
        while( k <= i)
        {
            if(k == 1 || k == i)
            {
                cout << ch;
            }
            else
            {
                cout << " ";
            }  
            k++;     
        }
        cout << "\n";
        i++;
    }	

    i = 1;
    while( i <= rows - 1)
    {
        j = 1;
    	while( j <= i)
		{
            cout << " ";
            j++;
        }

        k = rows - 1;
        while( k >= i)
        {
            if(k == rows - 1 || k == i)
            {
                cout << ch;
            }
            else
            {
                cout << " ";
            } 
            k--;
        }
        cout << "\n";
        i++;
    }
 	return 0;
}
Enter Hollow Left Pascals Star Triangle Row = 12
Enter Symbol for Hollow Left Pascals Triangle = $
Hollow Left Pascals Star Triangle Pattern
           $
          $$
         $ $
        $  $
       $   $
      $    $
     $     $
    $      $
   $       $
  $        $
 $         $
$          $
 $         $
  $        $
   $       $
    $      $
     $     $
      $    $
       $   $
        $  $
         $ $
          $$
           $