C Program to Print Hollow Mirrored Right Triangle Star Pattern

Write a C Program to Print Hollow Mirrored Right Triangle Star Pattern using for loop. This C example uses nested for loops and the for loops inside an if-else condition to print the mirrored hollow Right angled Triangle star pattern.

#include<stdio.h>
int main()
{
 	int i, j, rows; 
 	printf("Enter Hollow Mirrored Right Triangle Rows =  ");
 	scanf("%d", &rows);

    printf("Hollow Mirrored Right Triangl Star Pattern\n");
	for(i = 1; i <= rows; i++)
	{
        for(j = 1; j <= rows - i; j++)
        {
            printf(" ");
        }

        if(i == 1 || i == rows)
        {
            for(j = 1; j <= i; j++)
            {
                printf("*");
            }
        }
        else
        {
            for(j = 1; j <= i; j++)
            {
                if(j == 1 || j == i)
                {
                    printf("*");
                }
                else
                {
                    printf(" ");
                }
            }        
        }
		printf("\n");
	}
 	return 0;
}
C Program to Print Hollow Mirrored Right Triangle Star Pattern 1

This C Program Prints Hollow Mirrored Right Triangle Star Pattern using While loop. It allows entering symbols to print as Hollow Mirrored Right Triangle pattern.

#include<stdio.h>
int main()
{
 	int i, j, rows;
    char ch;
    
    printf("Symbol to Print Hollow Mirrored Right Triangle =  ");
    scanf("%c", & ch);

 	printf("Enter Hollow Mirrored Right Triangle Rows =  ");
 	scanf("%d", &rows);

    printf("Hollow Mirrored Right Triangl Star Pattern\n");
    i = 1;
	while(i <= rows)
	{
        j = 1;
        while(j <= rows - i)
        {
            printf(" ");
            j++;
        }

        if(i == 1 || i == rows)
        {
            j = 1;
            while(j <= i)
            {
                printf("%c", ch);
                j++;

            }
        }
        else
        {
            j = 1;
            while( j <= i)
            {
                if(j == 1 || j == i)
                {
                    printf("%c", ch);
                }
                else
                {
                    printf(" ");
                }
                j++;
            }        
        }
		printf("\n");
        i++;
	}
 	return 0;
}
Symbol to Print Hollow Mirrored Right Triangle =  #
Enter Hollow Mirrored Right Triangle Rows =  10
Hollow Mirrored Right Triangl Star Pattern
         #
        ##
       # #
      #  #
     #   #
    #    #
   #     #
  #      #
 #       #
##########