Write a C Program to Print Inverted Mirrored Right Triangle Star Pattern using for loop. This C example uses two for loops nested inside another to print the Inverted Mirrored Right Triangle pattern.
#include<stdio.h> int main() { int i, j, rows; printf("Enter Inverted Mirrored Right Triangle Rows = "); scanf("%d", &rows); printf("Inverted Mirrored Right Triangle Star Pattern\n"); for(i = rows; i > 0; i--) { for(j = rows - i; j > 0; j--) { printf(" "); } for(j = 0; j < i; j++) { printf("*"); } printf("\n"); } return 0; }
In this C Program, we used the while loop to Print Inverted Mirrored Right Triangle Pattern. It also allows to enter the inverted Mirrored Right angled Triangle pattern symbol.
#include<stdio.h> int main() { int i, j, rows; char ch; printf("Symbol to Print Inverted Mirrored Right Triangle = "); scanf("%c", & ch); printf("Enter Inverted Mirrored Right Triangle Rows = "); scanf("%d", &rows); printf("Inverted Mirrored Right Triangle Star Pattern\n"); i = rows; while(i > 0) { j = rows - i; while(j > 0) { printf(" "); j--; } j = 0; while( j < i) { printf("%c", ch); j++; } printf("\n"); i--; } return 0; }
Symbol to Print Inverted Mirrored Right Triangle = #
Enter Inverted Mirrored Right Triangle Rows = 9
Inverted Mirrored Right Triangle Star Pattern
#########
########
#######
######
#####
####
###
##
#