C Program To Print Half Pyramid Using *


Aim :- Write a C Program to Print Half Pyramid Using *(Star).

C program to For Generating Half Pyramid Using *.
The Number of Rows Will Be Given By User.


C++ Program Code :


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

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

      for(i=1; i<=n; ++i)
      {
            for(j=1; j<=i; ++j)
            {
                  printf("* ");
            }
      printf("\n");
      }

      getch();
}


Output :

Post a Comment

0 Comments