Write a program to print following output:

Solution:
For printing above output, first divide the above input into two parts. i.e (Binded Right Triangle and Inverted Right Angle Triangle)

Output:


Solution:
For printing above output, first divide the above input into two parts. i.e (Binded Right Triangle and Inverted Right Angle Triangle)

#include<stdio.h>
int main()
{
int i,a,b;
for(a=5, b=1; b<=5;a--,b++) // This loop to print part-1 output
{
for(i=1;i<b;i++)
printf(" ");
for(i=1;i<=a;i++)
printf("%d",i);
printf("\n");
}
for(a=4, b=2; b<=5;a--,b++) // This loop is to print part-2 output
{
for(i=1;i<a;i++)
printf(" ");
for(i=1;i<=b;i++)
printf("%d",i);
printf("\n");
}
return 0;
}
Output:



