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 9



#include

main()
{
    int n, c, k, space;

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

    space = n;

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

        space--;

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

        printf("\n");
    }
    getch();
    return 0;
}

----------------------

output:-
Enter number of rows
7
           *
         **
       ***
     ****
   *****
  ******
*******















No comments: