Signup/Sign In
LAST UPDATED: APRIL 17, 2023

List of All Star Pattern Programs in C Language

    Star Pattens, many of you would have seen these types of star pattern programs in your college years. It's a hectic process to make them but it's not as difficult as you think it is.

    Do you want to make these star patterns easily using the C language?

    Here is the tutorial where you will learn how to make Square Star Patterns, Hollow Square Star, Hollow Squares with Diagonal, Hollow Rhombus, Rhombus Star, Hollow Mirrored Rhombus, Right Triangles, and many patterns in C programming language.

    Let's dive into this amazing tutorial and help you make the star pattern in C easily!

    1. Square Star Pattern Programs

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= n; j++)  {  
                printf("* ");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    square

    2. Hollow Square Star Pattern Program

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= n; j++)  {  
                if(i == 1 || i == n || j == 1 || j == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    hollow square

    3. Hollow Square Pattern with Diagonal

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= n; j++)  {  
                if(i == 1 || i == n || j == 1 || j == n - i + 1 || i == j || j == n)  
                    printf("*");  
                else  
                   printf(" ");  
                }        
            printf("\n");  
        }  
        return 0;  
    }  

    hollow square with diagonal

    4. Rhombus Star Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i - 1; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= n; k++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    rhombus

    5. Hollow Rhombus Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i - 1; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= n; k++)  {  
                if(i == 1 || i == n || k == 1 || k == n)  
                    printf("*");  
                else  
                    printf(" ");   
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    hollow rhombus

    6. Mirrored Rhombus Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j < i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= n; k++)  {  
               printf("*");  
                  
            }  
            printf("\n");  
        }   
        return 0;  
    }  

    mirrored rhombus

    7. Hollow Mirrored Rhombus Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j < i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= n; k++)  {  
                if(i == 1 || i == n || k == 1 || k == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            printf("\n");  
        }    
        return 0;  
    }  

    hollow mirrored rhombus

    8. Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1;i <= n; i++)  {  
            for(int j = 1; j <= i; j++)  {  
                printf("* ");  
            }  
            printf("\n");  
        }  
     
        return 0;  
    }  

    right triangle

    9. Hollow Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1;i <= n; i++)  {  
            for(int j = 1; j <= i; j++)  {  
                if(j==1|| i==j || i==n )  
                    printf("*");  
                else  
                    printf(" ");  
                }  
            printf("\n");  
        }  
     
        return 0;  
    }  

    hollow right triangle

    10. Mirrored Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 1;
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i - 1; j++)  {  
              printf(" ");  
            }  
            for(int k = 1; k <= m; k++)  {  
                printf("*");  
            }  
            printf("\n");  
            m++;  
        }  
    
        return 0;  
    }  

    mirrored right triangle

    11. Hollow Mirrored Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 1;
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i - 1; j++)  {  
              printf(" ");  
            }  
            for(int k = 1; k <= m; k++)  {  
                if(k == 1 || k == m || m == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            printf("\n");  
            m++;  
        }  
        return 0;  
    }  

    hollow mirrored right triangle

    12. Inverted Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i; j++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    inverted right triangle

    13. Hollow Inverted Right Triangle Star Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j <= i; j++)  {  
                if(j == 1 || j == i || i == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            printf("\n");  
        }   
        return 0;  
    }  

    hollow inverted right triangle

    14. Inverted Mirrored Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = n;  
        for(int i = 1;i <= n; i++)  {  
            for(int j = 1; j < i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= m; k++)  {  
                printf("*");  
            }  
            m--;  
           printf("\n");  
        }    
        return 0;  
    }  

    inverted mirrored right triangle

    15. Hollow Inverted Mirrored Right Triangle Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = n;  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j < i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= m; k++)  {  
                if(i == 1 || k == 1 || k == m)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            m--;  
            printf("\n");  
        }    
        return 0;  
    }  

    hollow inverted mirrored right triangle

    16. Pyramid Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = n;  
        for(int i = 1; i <= n; i++)  
        {  
            for(int j = 1; j <= m - 1; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= 2 * i - 1; k++)  {  
                printf("*");  
            }  
            m--;  
            printf("\n");  
        }  
        return 0;  
    }  

    pyramid

    17. Hollow Pyramid Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = n;  
        for(int i = 1; i <= n; i++)  {  
            for(int j= 1; j<= m - 1; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= 2 * i - 1; k++)  {  
                if(k == 1 || k == 2 * i - 1 || i == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            m--;  
            printf("\n");  
        }  
        return 0;  
    }  

    hollow pyramid

    18. Inverted Pyramid Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 1;
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j < m; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= 2 * i - 1; k++)  {  
                printf("*");  
            }  
            m++;  
            printf("\n");  
        }
        return 0;  
    }  

    inverted pyramid

    19. Hollow Pyramid Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 1;
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j < m; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= 2 * i - 1; k++)  {  
                if(k == 1 || k == 2 * i - 1 || i == n)  
                    printf("*");  
                else  
                    printf(" ");  
            }  
            m++;  
            printf("\n");  
        }  
        return 0;  
    }  

    hollow pyramid

    20. Half Diamond Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= i; j++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        for(int i = n - 1; i >= 1; i--)  {  
            for(int j = 1; j <= i; j++)  {  
                printf("*");  
            }  
            printf("\n");  
        }    
        return 0;  
    }  

    half diamond

    21. Diamond Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int spaces = n - 1, characters = 1;  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= spaces; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= characters; k++)  {  
                printf("*");  
            }  
            if(spaces > i)  {  
                spaces = spaces - 1;  
                characters = characters + 2;  
            }  
            if(spaces < i)  {  
                spaces = spaces + 1;  
                characters = characters - 2;  
            }  
            printf("\n");  
        }   
        return 0;  
    }  

    diamond pattern

    22. Right Arrow Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 0; i < n; i++)  {  
            for(int j = 0; j < i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= n - i; k++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        for(int i = 1; i < n; i++)  {  
            for(int j = 1; j < n - i; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= i + 1; k++)  {  
                printf("*");  
            }  
            printf("\n");  
        }    
        return 0;  
    }  

    right arrow

    23. Left Arrow Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            for(int j = 1; j <= n - i; j++)  {  
                printf(" ");  
            }  
            for(int k=0;k<=n-i;k++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        for(int i = 1; i < n; i++)  {  
            for(int j = 1; j < i + 1; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= i + 1; k++)  {  
                printf("*");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    left arrow

    24. Plus Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        for(int i = 1; i <= n; i++)  {  
            if(i == ((n / 2) + 1))  {  
                for(int j = 1; j <= n; j++)  {  
                    printf("+");  
                }  
            }  
            else  {  
                for(int j = 1; j <= n / 2; j++)  {  
                    printf(" ");  
                }  
                printf("+");  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    plus

    25. X Pattern

    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 2 * n - 1;  
        for(int i = 1; i <= m; i++)  {  
            for(int j = 1; j <= m; j++) {  
                if(i == j || j == (m - i + 1))  {  
                    printf("*");  
                }  
                else  {  
                    printf(" ");  
                }  
            }  
            printf("\n");  
        }  
        return 0;  
    }  

    x pattern

    Conclusion

    This article has presented a comprehensive list of star pattern programs in the C programming language, including Square Star Patterns, Hollow Square Stars, Hollow Squares with Diagonal, Rhombus Stars, Hollow Rhombus, Mirrored Rhombus, Hollow Mirrored Rhombus, Right Triangles, and many more. Each of these programs is explained with the help of the source code, making it easy for you to understand and implement them. We also make sure to cover almost every pattern that we can do with C programming.

    If you are still wondering how we did it, you can learn C programming language for absolutely free with our easy-to-use and interactive course.

    Frequently Asked Questions(FAQs)

    1. What is star pattern in C?

    Star pattern in C programming language are shapes that are made up of * or any other symbols. You can make these types of shapes with any programming language.

    2. How to print a star pattern in C?

    To print a star pattern in C, you have to write a program in C and run it. Here is an example-

    
    #include <stdio.h>  
    int main()  
    {  
        int n;  
        printf("Enter the number of rows in your pattern: ");  
        scanf("%d",&n);  
        int m = 1;
        for(int i = n; i >= 1; i--)  {  
            for(int j = 1; j < m; j++)  {  
                printf(" ");  
            }  
            for(int k = 1; k <= 2 * i - 1; k++)  {  
                printf("*");  
            }  
            m++;  
            printf("\n");  
        }
        return 0;  
    }  
     
    

    This is the output of this code -

    inverted pyramid

    3. How can I learn to create star pattern programs in C language?

    You can learn to create star pattern programs in C language by studying tutorials and examples online or in programming books or learn C language for absolutely free with Studytonight's easy-to-use and interactive course.

    4. What are some popular star pattern programs in C language?

    Some popular star pattern programs in C language include square star patterns, hollow square star patterns, hollow squares with diagonal, rhombus star patterns, hollow rhombus patterns, mirrored rhombus patterns, and right triangle patterns.

    You May Also Like:

    Aditi Verma is a skilled author and content creator with expertise in programming languages such as C and C++, as well as Data Structure and DBMS. With an educational background in Computer Science, Aditi's writing is both informative and engaging.
    IF YOU LIKE IT, THEN SHARE IT
    Advertisement

    RELATED POSTS