Star Printing : pattern 4 (Right Side Opposite Triangle) in C Programming

If you have seen previous patterns then it is very easy. These patterns helped me understanding loops.

Here is my Code :

int p, q, r, k = 5; // “k” is for taking inputs from users.
for (p = 1; p <= k; p++)
{
for (q = 1; q < p; q++)
{
printf(” “);
}
for (r = 5; r >= p; r–)
{
printf(“*”);
}
printf(“\n”);
}

(Visited 85 times, 1 visits today)

About the Author:

Suniv Ashraf

Leave A Comment