57. Pattern 10

Image result for c programming
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5

Code:
  #include<stdio.h>
int main()
{
  int n,i,j,k=1,x;
  scanf("%d",&n);
  x=n;
  for (i=1;i<=n;i++)
  {
    for(j=1;j<=x;j++)
    {
      printf("%d ",k);
    }
    printf("\n");
    k++;
    x--;
  }

  return 0;
}

No comments