Pages

Sunday, 14 June 2015

Number pattern 11

Number pattern 11

Coding:

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

Output:
Please enter number of lines:5
55555
3434
333
12
1