Right Triangle Star Pattern in C

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

OffCampus Updates

Never Miss OffCampus Updates

Get OffCampus Update from PrepInsta

Follow us on our Social Media Handles

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