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 12



#include

main()
{
    int n, c, k, space, count = 1;

    printf("Enter number of rows\n");
    scanf("%d",&n);

    space = n;

    for ( c = 1 ; c <= n ; c++)
    {
        for( k = 1 ; k < space ; k++)
           printf(" ");

        for ( k = 1 ; k <= c ; k++)
        {
            printf("*");

            if ( c > 1 && count < c)
            {
                 printf("A");
                 count++;
            }
        }

        printf("\n");
        space--;
        count = 1;
    }
    getch();
    return 0;
}


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

Enter number of rows::5
        *
      *A*
    *A*A*
  *A*A*A*
*A*A*A*A*


















No comments: