About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Saturday, December 10, 2011

Pattern Printing 6



#include

main()
{
      int n, c, k, x = 1;
      clrscr();
      printf("Enter number of rows::");

      scanf("%d", &n);

      for ( c = 1 ; c <= n ; c++ )
      {
          for ( k = 1 ; k <= c ; k++ )
          {
              printf("%d", x);
              x++;
          }

          x--;

          for ( k = 1 ; k <= c - 1 ; k++ )
          {
              x--;
              printf("%d", x);
          }

          printf("\n");
          x = 1;
      }
      getch();
      return 0;
}

--------------------------------
output:-
Enter number of rows::6
1
121
12321
1234321
123454321
12345654321

















No comments: