C Program to Print Half Pyramid


In this program we will print half pyramid using *

  1. //half pyramid
  2. #include <stdio.h>
  3. int main()
  4. {
  5. int i, j, rows;
  6. printf("Enter number of rows: ");
  7. scanf("%d",&rows);
  8. for(i=1; i<=rows; ++i)
  9. {
  10. for(j=1; j<=i; ++j)
  11. {
  12. printf("* ");
  13. }
  14. printf("\n");
  15. }
  16. return 0;
  17. }

Output

Output!