C Program to display the following PATTERN

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

OUTPUT:

No comments:

Post a Comment