Select Page

How to make an inverted mirror right triangle using star Symbol – In this tutorial, we will send a message on the large number of techniques to print a modified inverted mirror right triangle using star symbol in the C program.

Appropriate models and test programs have likewise been included with the goal that you can comprehend the entire thing obviously. The compiler has likewise been included with which you can execute it yourself.

The following Pattern program is written in three unique manners:

• For Loop
•  While Loop
•  Do-While Loop

An inverted mirror Right triangle is an extremely regular sort of two-dimensional figure utilized in the field of geometry. It is a sort of a triangle that has one edge equivalent to 90 degrees.

The total of squares of the sides neighboring the correct point is equivalent to the square of the side inverse to the correct edge.

Enter Size: 5 According to the above Pattern number of rows specified 5 and the number of Columns specified also 5.

The Star Symbol(‘*’) is picked to do the distinctions according to the name of the title itself.

## Triangle Pattern using For Loop

### Algorithm

Input: Let, three variables say r,c,s. The value of n will be given by the user.

step 1: Input values for s

step 2: r=1 and outer loop will be performed as long as r<=s

step 3: c=1

step 4: inner loop will be performed as long as  c<=s

step 4.1: check if (c>=r) is true then

print symbol star (‘*’)

else

print  “blank space”

step 5: j=j+1

step 6: End inner loop

step 7: next line start

step 8: i= i+1

step 9:  End outer loop

### Source Code

```int main()
{
int r,c,s;
printf("\n\tEnter Size:");
scanf("%d",&s);
printf("\n\t");
for(r=1; r<=s; r++)
{
for(c=1; c<=s; c++)       {         if (c>=r)
printf("*");
else
printf(" ");
}
printf("\n");
printf("\t");
}
return 0;
}
```

## Triangle Pattern using while Loop

```int main()
{
int r,c,s;
printf("ntEnter no:");
scanf("%d",&s);
printf("\t");
r=1;
while(r<=s)
{
c=1;
while(c<=s)         {            if(c>=r)
printf("*");
else
printf(" ");
c++;
}
r++;
printf("\n");
printf("\t");
}
}
``` ## Triangle Pattern using do..while Loop

```int main()
{
int r,c,s;
printf("ntEnter no:");
scanf("%d",&s);
printf("\t");
r=1;
do
{
c=1;
do
{
if(c>=r)
printf("*");
else
printf(" ");
c++;
}while(c<=s);

r++;
printf("\n");
printf("\t");
} while(r<=s);
}

``` 