Print Pyramid Pattern of Numbers and Stars in C

Notes:

Print Pyramid Pattern of Numbers and Stars in C Programming:
Displaying stars and numbers in pyramid shape or pyramid pattern in C:

Ex1:
int row=0;
int col=0;
int totalRows=3;
int space=0;

for(row=1; row<=totalRows; row++)
{
for(space=1; space<=(totalRows-row); space++)
{
printf(" ");
}
for(col=1; col<=row; col++)
{
printf("* ");
}
printf("\n");
}
Output:
*
* *
* * *

Ex2:
int row=0;
int col=0;
int totalRows=3;
int space=0;

for(row=1; row<=totalRows; row++)
{
for(space=1; space<=(totalRows-row); space++)
{
printf(" ");
}
for(col=1; col<=row; col++)
{
printf("%d ",row);
}
printf("\n");
}
Output:
1
2 2
3 3 3

Ex3:
int row=0;
int col=0;
int totalRows=3;
int space=0;

for(row=1; row<=totalRows; row++)
{
for(space=1; space<=(totalRows-row); space++)
{
printf(" ");
}
for(col=1; col<=row; col++)
{
printf("%d ",col);
}
printf("\n");
}
Output:
1
1 2
1 2 3