DEV Community

Cover image for How to print star pattern in c programming
Thecodepedia
Thecodepedia

Posted on

How to print star pattern in c programming

Hello, folks in this post I will share how to print pattern in c programming. using c programming you can make a lot of projects. But now we are going to make an amazing pattern.

Video tutorial of this pattern


#include <stdio.h>
int main()
{
    int a, b, c, n = 5;
    for (a = n; a >= 1; a--)
    {
        for (b = n - 1; b >= a; b--)
        {
            printf(" ");
        }
        for (c = 1; c <= a; c++)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Thanks for watching this post. You can visit here for more coding tutorials.

Discussion (0)