C Program to print Right Arrow in a star pattern Type 1

Program

#include <stdio.h>
void main()
{
	int n;
	printf("Enter the number of rows to print:\t");
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		for (int j = 0; j < i; j++)
		{
			printf(" ");
		}
		for (int k = 0; k < i; k++)
		{
			printf("*");
		}
		printf("\n");
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i; j++)
		{
			printf(" ");
		}
		for (int k = 0; k < n - i; k++)
		{
			printf("*");
		}
		printf("\n");
	}
}

Output

Enter the number of rows to print:      5
 *
  **
   ***
    ****
     *****
    ****
   ***
  **
 *