WAP C++ to star pattern in center

    * 
   * * 
  * * * 
 * * * * 
* * * * * 

Code:-
#include <iostream>
using namespace std;

int main()
{
	
	int n=5,i, j, k = n;

	// Outer loop The rows
	for (i = 1; i <= n; i++) {

		// Inner loop for  columns
		for (j = 1; j <= n; j++) {

			// Condition to print star(*) pattern
			if (j >= k)
				cout << "* ";
			else
				cout << " ";
		}
		k--;
		cout << "\n";
	}
	return 0;
}