42. WRITE A C PROGRAM TO PRINT RIGHT TRIANGLE STAR PATTERN

/*C program to print right triangle star pattern*/

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

/* C program to print right triangle star pattern series*/


#include <stdio.h>


int main()

{
int i, j, n;

//Reads the number of rows to be printed from user

printf("Enter value of n: ");
scanf("%d", &n);

for(i=1; i<=n; i++)

{
//Print i number of stars
for(j=1; j<=i; j++)
{
printf("*");
}

//Move to next line/row

printf("\n");
}

return 0;

}

output

Enter the value of n: 5 
*
**
***
****
*****

Comments