Write a C++ program to print the left pascals star triangle using for loop.
#include<iostream>
using namespace std;
int main()
{
int i, j, k, rows;
cout << "Enter Left Pascals Star Triangle Row = ";
cin >> rows;
cout << "Left Pascals Star Triangle Pattern\n";
for(i = 1; i <= rows; i++)
{
for(j = i; j < rows; j++)
{
cout << " ";
}
for(k = 1; k <= i; k++)
{
cout << "* ";
}
cout << "\n";
}
for(i = rows; i >= 1; i--)
{
for(j = i; j <= rows; j++)
{
cout << " ";
}
for(k = 1; k < i; k++)
{
cout << "* ";
}
cout << "\n";
}
return 0;
}

This C++ example prints the left pascals triangle pattern 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 Left Pascals Star Triangle Row = ";
cin >> rows;
cout << "Symbol to print Left Pascals Star Triangle = ";
cin >> ch;
cout << "Left Pascals Star Triangle Pattern\n";
while(i <= rows)
{
j = i;
while( j < rows)
{
cout << " ";
j++;
}
k = 1;
while( k <= i)
{
cout << ch << " ";
k++;
}
cout << "\n";
i++;
}
i = rows;
while( i >= 1)
{
j = i;
while( j <= rows)
{
cout << " ";
j++;
}
k = 1;
while( k < i)
{
cout << ch << " ";
k++;
}
cout << "\n";
i--;
}
return 0;
}
Enter Left Pascals Star Triangle Row = 13
Symbol to print Left Pascals Star Triangle = &
Left Pascals Star Triangle Pattern
&
& &
& & &
& & & &
& & & & &
& & & & & &
& & & & & & &
& & & & & & & &
& & & & & & & & &
& & & & & & & & & &
& & & & & & & & & & &
& & & & & & & & & & & &
& & & & & & & & & & & & &
& & & & & & & & & & & &
& & & & & & & & & & &
& & & & & & & & & &
& & & & & & & & &
& & & & & & & &
& & & & & & &
& & & & & &
& & & & &
& & & &
& & &
& &
&