Print Star Pattern Triangle using loop

By | June 19, 2019

Print Star Pattern Triangle using loop is a C program. It prints a right angle triangle of stars as following:

*

**

***

*****

******

/*Write a C Program to print 
the following Star Pattern
*
**
***
****
*****
*/

#include <stdio.h>

int main()
{
    int row, col;
    for(row=1;row<=5;row++)
    {
        for(col=1;col<=row;col++)
        {
            printf("*");
        }
        printf("\n");
    }

    return 0;
}

This image shows a sample run and output of the c program to show a star triangle as required:

Print Star Pattern Triangle using loop is a C program. It prints a right angle triangle of stars as following image.

Print Star Pattern Triangle using loop is a C program. It prints a right angle triangle of stars as following image.

Leave a Reply

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