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 5



#include
#include

main()
{
      char string[100];
      int c, k, length;
      clrscr();

      printf("Enter a string\n");
      gets(string);

      length = strlen(string);

      for ( c = 0 ; c < length ; c++ )
      {
          for( k = 0 ; k <= c ; k++ )
          {
               printf("%c", string[k]);
          }
          printf("\n");
      }
      getch();
      return 0;
}


-----------------------------
output:-

Enter a string
amit singh
a
am
ami
amit
amit
amit s
amit si
amit sin
amit sing
amit singh












No comments: