109. C Program to Print Number Triangle.
How does this program work?
- This Program is used to print the number triangle from the given pattern.
Here is the code
int main(void)
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf(" " "%d",i);
printf(" ");
}
printf("\n");
}
for(i=1;i<=5;i++)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf(" " "%d",j);
printf(" ");
}
printf("\n");
}
return 0;
}