C Program to Print Star Pyramid Triangle

Display Pyramid triangle stars in C Programing Language with source code

This is one of the basic and common program mostly asked in interview question and the pyramid triangle program is the best example for loop example. Our aim of the program is to display starts like below

Just use the below source code program to display pyramid triangle.

int i, j, n, temp;
printf("Enter the number of rows in pyramid of stars you wish to see ");
temp = n;
for ( i = 1 ; i <= n ; i++ ){
for ( j = 1 ; j < temp ; j++ )
printf(" ");
for ( j = 1 ; j <= 2*i - 1 ; j++ )
return 0;

Related Topic Java Program for Star Pyramid
Java Program Source Code to Print Pascal Triangle
C Program to Print Pascal Triangle
C Program to Print Floyd's triangle
Floyd's Triangle in Java Program

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback