Left Triangle Star Pattern in C Language with Free Codes

Left Triangle Star Pattern

Left Triangle Star Pattern resemble a Right-Triangle Star Pattern with the stars aligned to the left side of the each row. Each row has an increasing number of stars as it moves downwards, forming a triangular shape.

Output

Enter the number of rows: 5
* 
* * 
* * * 
* * * * 
* * * * *
C Language Free Notes

Codes for Left Triangle Star Pattern

Here are the codes of Left Triangle Star Pattern,1.

#include <stdio.h>

int main() {
    int rows, i, j;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);

    for (i = 1; i <= rows; i++) {
        for (j = 1; j <= i; j++) {
            printf("* ");
        }
        printf("\n");
    }

    return 0;
}

Code Explanation

  1. The Code Shows the Prompt to the user for enter the number of rows for the left triangle.
  2. It iterates through each row using a for loop. Within each row, it prints stars using another nested for loop.
  3. The number of stars in each row increases with the row number.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top