Chapter:

Pattern-Printing-in-C

C program to print following Pyramid:


        *

       * *

      * * *

     * * * *

    * * * * *

    * * * * *

     * * * *

      * * *

       * *

        *

#include<stdio.h>

int main()
{
    int i,n,j;
    int space=4;
    printf("Enter number of rows:\n");
    fflush(stdout);
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=0;j<(n-i);j++)
        {
            printf(" ");
        }
        for(j=1;j<=2*i-1;j++)
        {
        	if(j%2!=0)
        	{
        		printf("*");
        	}
        	else
        	{
    ....
Show More

All Chapters

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