Pages

Sunday, 14 June 2015

Number pattern 13

Number pattern 13

Coding:

#include<stdio.h>
int main()
{
int i,j,n,a;
printf("Please enter number of lines:");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=i,a=i;j>=1;j--)
{
if(i%2)
printf("%d",a--);
else
printf("%d",a++);
}
printf("\n");
}
return 0;
}

Output:
Please enter number of lines:5
54321
4567
321
23
1