Print star triangle center pattern

By | June 19, 2019

“Print star triangle center pattern” is C program to print the given output of stars pattern as shown below:

"Print star triangle center pattern" is C program to print the given output of stars pattern as shown below:

“Print star triangle center pattern” is C program to print the given output of stars pattern as shown below:

/*
Write a C program to print star pattern
triangle as shown below
    *
   *** 
  *****
 *******
*********

*/
#include<stdio.h>  
int main()   
{   
  int row, col, space=5, s;  
  for( row = 1; row <= 9;row+=2 ) 
  {
  	for(s=1; s<=space;s++)
  	   printf(" ");
  	for(col=1; col<=row; col++)
	   printf("*");   
  	printf("\n");
  	space--;
  }
  return 0;
}

  
  

Here is an image to show sample run and output of the C program to print the stars pattern as shown.

"Print star triangle center pattern" is C program to print the given output of stars pattern as shown below:

“Print star triangle center pattern” is C program to print the given output of stars pattern as shown below:

 

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *