Write a program to print the given pattern.
Input Format:
Input consists of a single integer.
Output Format:
Refer sample output. There is a trailing space at the end of each line.
Sample Input:
5
5 4 5 3 4 5 2 3 4 5 1 2 3 4 5
code:
#include<stdio.h> int main(){ int n,i,j; scanf("%d",&n); for(i=n;i>=1;i--) { for(j=i;j<=n;j++){ printf("%d ",j); } printf("\n"); } return 0; }
#include
ReplyDeleteint main(){
int n,i,j,a,k;
scanf("%d",&n);
for(i=n;i>=1;i--)
{
k=i;
for(j=i;j<=a;j++){
printf("%d ",k);k++;
}
printf("\n");a++;
}
return 0;
}
#include
ReplyDeleteint main()
{
int n,i,j,a,k;
scanf("%d",&n);
for(i=n;i>=1;i--)
{
k=i;
for(j=i;j<=n;j++)
{
printf("%d ",k);
k++;
}
printf("\n");
a++;
}
return 0;
}