Print star pattern triangle upside down

By | June 19, 2019

Print star pattern triangle is a C program to display the following out put star pattern. It is upside down triangle of stars made by c program.

It is upside down triangle c program.

It is upside down triangle c program.

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


*****
 **** 
  *** 
   ** 
    *

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

  
  

This is an image of C program to print upside down triangle pattern of stars with sample run and output.

This is an image of C program to print upside down triangle pattern of stars with sample run and output.

This is an image of C program to print upside down triangle pattern of stars with sample run and output.

Loading

Leave a Reply

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