C Program to Print Full Pyramid Using *


Aim :- Write a C Program to Print Full Pyramid Using *.

C program to For Generating Full Pyramid Using * (Star).
The Number of Rows Will Be Given By User.


C++ Program Code :


#include<stdio.h>
#include<conio.h>
void main()
{
      int i, j, n, k=0;
      clrscr();

      printf("\nC Program To Print Full Pyramid Using *.");
      printf("\n\nEnter Number of Rows : ");
      scanf("%d",&n);

      for(i=1; i<=n; ++i, k=0)
      {
            for(j=1; j<=n-i; ++j)
            {
                  printf("  ");
            }

            while(k != 2*i-1)
            {
                  printf("* ");
                  ++k;
            }

            printf("\n");
      }

      getch();
}


Output :

Post a Comment

0 Comments