Pages

Thursday, 17 September 2015

Number Pattern 15


Number Pattern 15|C Program Coding:

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

Output:
Please enter total number of lines:5

1234554321
1234**4321
123****321
12******21
1********1