Home

A program to print the format - right angled star triangle

C Programming Language 042

The following code shows how to write a program to print the following format.

*
**
***
****

Program

#include <stdio.h>

void main()
{
    int i, j;
    for (i = 1; i <= 4; i++)
    {
        for (j = 1; j <= i; j++)
        {
            printf("*");
        }
        printf("\n");
    }

    printf("\n");
}

Result

*
**
***
****


Last Updated on

Next Post: Rules vs Guidelines →

Comments