Draw a triangle using * 1


#include <stdio.h>
int main()
{
    int i,j,r;
    printf(“Enter the number of rows: “);
    scanf(“%d”,&r);
    for(i=1;i<=r;++i)
    {
        for(j=1;j<=i;++j)
        {
           printf(“* “);
        }
        printf(“\n”);
    }
    return 0;
}

output:

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


Leave a comment

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

One thought on “Draw a triangle using *