C++ Program to Print Hollow Rhombus Star Pattern

Write a C++ program to print the hollow rhombus star pattern using for loop. 

#include<iostream>
using namespace std;

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

    cout << "Hollow Rhombus Star Pattern\n"; 

    for(i = 1; i <= rows; i++)
    {
    	for(j = 1; j <= rows - i; j++)
		{
            cout << " ";
        }
        for(k = 1; k <= rows; k++)
        {
            if (i == 1 || i == rows || k == 1 || k == rows)
            {
                cout << "* ";
            }
            else
            {
                cout << "  ";
            }
        }
        cout << "\n";
    }		
 	return 0;
}
C++ Program to Print Hollow Rhombus Star Pattern

This C++ example prints the hollow rhombus 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 Hollow Rhombus Star Pattern Row = ";
    cin >> rows;

    cout << "Enter Symbol for Hollow Rhombus Pattern = ";
    cin >> ch;

    cout << "Hollow Rhombus Star Pattern\n"; 

    while( i <= rows)
    {
        j = 1; 
    	while(j <= rows - i)
		{
            cout << " ";
            j++;
        }
        k = 1;
        while( k <= rows)
        {
            if (i == 1 || i == rows || k == 1 || k == rows)
            {
                cout << ch << " ";
            }
            else
            {
                cout << "  ";
            }
            k++;
        }
        cout << "\n";
        i++;
    }		
 	return 0;
}
Enter Hollow Rhombus Star Pattern Row = 16
Enter Symbol for Hollow Rhombus Pattern = @
Hollow Rhombus Star Pattern
               @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 
              @                             @ 
             @                             @ 
            @                             @ 
           @                             @ 
          @                             @ 
         @                             @ 
        @                             @ 
       @                             @ 
      @                             @ 
     @                             @ 
    @                             @ 
   @                             @ 
  @                             @ 
 @                             @ 
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @