Print star pattern center down triangle

By | June 19, 2019

“Print star pattern center down triangle” is C language program using nested for loop concept. It displays the required output of stars pattern as shown in the figure.

"Print star pattern center down triangle" is C language program using nested for loop concept. It displays the required output of stars pattern as shown in the figure.

“Print star pattern center down triangle” is C language program using nested for loop concept.

 

/*
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 = 9; row >= 1;row-=2 ) 
  {
  	for(s=1; s<=space;s++)
  	   printf(" ");
  	for(col=1; col<=row; col++)
	   printf("*");   
  	printf("\n");
  	space++;
  }
  return 0;
}

  
  

Here is the image to show a sample run of stars pattern C program with sample output as required.

"Print star pattern center down triangle" is C language program using nested for loop concept.

“Print star pattern center down triangle” is C language program using nested for loop concept.

Loading

Leave a Reply

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