print a pattern as shown below


Pyramid 

A pyramid is a structure whose outer surfaces are triangular and converge to a single step at the top, making the shape roughly a pyramid in the geometric sense. 

 

QUESTION:- print a pattern as shown below  

        *  

      *   *  

    *   *   *  

  *  *    *   *  

  

#include <stdio.h>

#include <conio.h>

int main()

{

    int ijkno;

    printf("Enter a value: ");

    scanf("%d", &no);

    // rows

    for (i = 1i <= noi++)

    {

        // space

        for (j = noj >= ij--)

        {

            printf(" ");
        }

        // display

        for (k = 1k <= ik++)

        {

            printf("* ");
        }

        printf("\n");
    }

    return 0;

    getch();
}


Note:- you can make changes to all the patterns according to your wants and need. 


OUTPUT

Enter a value: 5

     * 

    * *

   * * *

  * * * *

 * * * * *


Follow our page for regular updates.

0 Comments