C++ Program to Print Left Arrow Star Pattern

Write a C++ Program to print left arrow star pattern using for loop. 

#include<iostream>
using namespace std;

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

    cout << "Left Arrow Star Pattern\n"; 

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

    for(i = 1; i < rows; i++)
    {
    	for(j = 0; j < i; j++)
		{
            cout << " ";
        }
        for(k = 0; k <= i; k++)
        {
            cout << "*";
        }
        cout << "\n";
    }
 	return 0;
}
C++ Program to Print Left Arrow Star Pattern

This C++ example prints the left arrow pattern of a given character using a while loop.

#include<iostream>
using namespace std;

int main()
{
	int i, j, k, rows;
    char ch;
     
    cout << "Enter Left Arrow Star Pattern Row = ";
    cin >> rows;

    cout << "Enter Symbol for Left Arrow Pattern = ";
    cin >> ch;

    cout << "Left Arrow Star Pattern\n"; 

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

    i = 1;
    while( i < rows)
    {
        j = 0;
    	while( j < i)
		{
            cout << " ";
            j++;
        }
        k = 0;
        while( k <= i)
        {
            cout << ch;
            k++;
        }
        cout << "\n";
        i++;
    }
 	return 0;
}
Enter Left Arrow Star Pattern Row = 14
Enter Symbol for Left Arrow Pattern = %
Left Arrow Star Pattern
             %%%%%%%%%%%%%%
            %%%%%%%%%%%%%
           %%%%%%%%%%%%
          %%%%%%%%%%%
         %%%%%%%%%%
        %%%%%%%%%
       %%%%%%%%
      %%%%%%%
     %%%%%%
    %%%%%
   %%%%
  %%%
 %%
%
 %%
  %%%
   %%%%
    %%%%%
     %%%%%%
      %%%%%%%
       %%%%%%%%
        %%%%%%%%%
         %%%%%%%%%%
          %%%%%%%%%%%
           %%%%%%%%%%%%
            %%%%%%%%%%%%%
             %%%%%%%%%%%%%%

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.