Is this is the output you are looking for:
4 3 2 1 2 3 4
3 2 1 2 3
2 1 2
1
You need to output spaces for the overhangs, this means you always have to print from 4, even if only an empty field. The code change is here:
int main()
{
int rows, col;
for (rows = 4; rows >= 1; rows--)
{
for (col = 4; col >= 1; col--)
{
if (col <= rows)
{
printf(" %d", col);
}
else
{
printf(" ");
}
}
for (col = 2; col <= 4; col++)
{
if (col <= rows)
{
printf(" %d", col);
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}