Sponsors

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”);
}

Sponsors

LEAVE A REPLY

Please enter your comment!
Please enter your name here