Pages

Sunday, 14 June 2015

Number pattern 9

Number pattern 9

Coding:

#include
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)
printf("%d",i);
else
printf("%d",i-1);
}
printf("\n");
}
return 0;
}

Output:
Please enter number of lines:5
54545
3434
323
12
1