I was just trying to solve this problem in my own way. If you have any better code then please feel free to share it in the comment section.

Here is the Code :

int main()
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 1; j <= i; j++)
{
printf(“*”);
}
printf(“\n”);
}