PATTERN / PRAYMID (C++)

Description:

Program to print solid and hollow rectangle star pattern is discussed here. Given the number of rows and columns, print the solid and hollow rectangle star patterns. Solid rectangular star pattern: Number of rows: 3 Number of columns: 5 * * * * * * * * * * * * * * *

Program :

/* C++ program to print solid rectangle star pattern */

#include <iostream>

using namespace std;

/* Function to print solid rectangle*/

void solid_rectangle(int n, int m)

{

int i, j;

for (i = 1; i <= n; i++)

{

for (j = 1; j <= m; j++)

{

cout << “*”;

}

cout << endl;

}

}

int main()

{

int rows, columns;

cout << “\nEnter the number of rows : “;

cin >> rows;

cout << “\nEnter the number of columns : “;

cin >> columns;

cout << endl;

solid_rectangle(rows, columns);

return 0;

}