Star pattern Right Angle Triangle

By | June 19, 2019

Star pattern Right Angle Triangle is a C program to display right angle triangle of stars using nested for loop.

Print star pattern right angle triangle c program

Print star pattern right angle triangle c program

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

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

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

  
  

This is an image showing sample run and output of star pattern program in C language.

This is an image showing sample run and output of star pattern program in C language.

This is an image showing sample run and output of star pattern program in C language.

Loading

Leave a Reply

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