Pattern 4

Description:

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample outputs. There is a trailing space at the end of each line. Sample Input: 5 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5

Program :

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