Right Triangle Star Pattern in C

Right Triangle Star Pattern

To print the Right Triangle Star Pattern in C , we need two loop. first is outer loop and second is inner loop.  First loop that is the outer loop works on the row or line and the another loop that is inner loop works on the column mean how many start you want to put in the single line.  So here we need to now proper working of the loop that we can easily make a desired pattern.

Now we will discuss all possible star pattern using C.

right triangle star pattern

Write a Program to print the following pattern.

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

Working

  • Step 1- First you need to initialize two variable for loop.
  • Step 2- The first loop  for the row.
  • Step 3-  The second loop work for the column.
  • Step 4- Now print the *.
  • Step 5- Now out side of loop, put new line.
  • Step 5- Stop.

Program to print Right Triangle Star Pattern in C

#include<stdio.h>
int main()
{
    int i, j;
   for(i=1; i<=5; i++)
    {
        for(j=1; j<=i; j++)
        {
            printf("* ");
        }
        printf("\n");
    }
    return 0;
}

Comments