Print the right triangle star pattern
#include <stdio.h>
int main()
{
int i, j, n;
/* Input number of rows 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 */
printf("\n");
}
return 0;
}
Output
Enter the value of n: 5
*
**
***
****
*****
0 Comments