In this tutorial, we will write a C program to print a hollow triangle star pattern. Before that, you may go through the following topics in C.
Hollow Triangle Pattern in C
Hollow equilateral triangle pattern in C.
#include <stdio.h>
int main()
{
int i, j, k, rows;
printf("Enter the no. of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; i++)
{
for (j = i; j < rows; j++)
{
printf(" ");
}
for (k = 1; k <= (2 *i - 1); k++)
{
if (k == 1 || i == rows || k == (2 *i - 1))
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
Output:
