Q5. Pattern Series using nested loop

#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,n;
   clrscr();
   printf("Enter number of rows: ");
   scanf("%d",&n);
   for(i=1;i<=n;i++)
   {
      for(j=1;j<=i;j++)
      {
         printf("%d ",j);
      }
      printf("\n");
   }
   for(i=n;i>=1;i--)
   {
      for(j=1;j<=i;j++)
      {
         printf("%d ",j);
      }
      printf("\n");
   }
   getch();
}
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1