Pyramid Star Pattern....

 





Program in C to print star pyramid pattern .

 
#include<stdio.h>

#include<conio.h>

int main()

{

int n, s, i, j;

printf("Enter number of rows: ");

scanf("%d",&n);

for(i = 1; i <= n; i++)

{

//for loop for displaying space

for(s = i; s < n; s++)

{

printf(" ");

}

//for loop to display star equal to row number

for(j = 1; j <= (2 * i - 1); j++)

{

printf("*");

}

// ending line after each row

printf("\n");

}

}


Output:



Popular posts from this blog

Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.

In this challenge, we're going to use loops to help us do some simple math.

Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN.