Select Page

How to design inverted right triangle using star Symbol – In this article, we will detail in on the large number of techniques to print a modified right triangle star design in C programming.

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:

• Utilizing For Loop
• Utilizing While Loop
• Utilizing Do-While Loop

An Inverted 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 No: 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.

## Inverted Right Angle 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: 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>=1&&c<s+1-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>=1&&c<s+1-r)
printf("*");
else
printf(" ");
}
printf("\n");
printf("\t");
}
return 0;
}
```

## Inverted Right Angle Triangle Pattern using While Loop

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

## Inverted Right Angle Triangle Pattern using do..while Loop

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

```