Program of display the pyramid of *


#include <stdio.h>
int main()
{
    int i,s,r,k=0;
    printf(“Enter the number of rows: “);
    scanf(“%d”,&rows);
    for(i=1;i<=r;++i)
    {
        for(s=1;s<=r-i;++s)
        {
           printf(”  “);
        }
        while(k!=2*i-1)
        {
           printf(“* “);
           ++k;
        }
        k=0;
        printf(“\n”);
    }
    return 0;
}

output

     
        *
      * * *
    * * * * *
  * * * * * * *
* * * * * * * * *

Leave a comment

Your email address will not be published. Required fields are marked *