Chapter:

Pattern-Printing-in-C

Program to print full pyramid using *

        *

      * * *

    * * * * *

  * * * * * * *

* * * * * * * * *

Source Code

#include
int main()
 {
    int i, j, rows, k=0;
    printf("Enter number of rows: ");
    fflush(stdout);
    scanf("%d", &rows);
    for (i=1; i<=rows; i++,k=0)
     {
        for (j=1; j<=rows-i; j++)
        {
        	 printf("  ");
         }
        while (k!=2*i-1) 
        {
            printf("* ");
            k++;
        }
        printf("\n");
    }    
    return 0;
}

Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-