Signup/Sign In
LAST UPDATED: JANUARY 10, 2022

Print Square Star Pattern Program In C Language

Learn C language tutorial

Logic To Print Square Star Pattern Program:

  • Get the value from the user to print the square star pattern
  • To print the square star pattern for loop is used,
  • Use an inner loop and outer loop to print square pattern,
  • The inner loop is used to print the character, and the outer loop is used to print the rows.

C Program To Print The Square Star Pattern:

#include<stdio.h>
int main()
{
    int x = 0,y = 0;
    unsigned int squareSide = 0;
    printf("Enter The Value To Print The Square Star Pattern = ");
    scanf("%u",&squareSide);
    
    for(x = 0; x < squareSide; ++x)
    {
    
        for(y = 0; y < squareSide; ++y)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

Output:

Square Star



About the author:
I like writing content about C/C++, DBMS, Java, Docker, general How-tos, Linux, PHP, Java, Go lang, Cloud, and Web development. I have 10 years of diverse experience in software development. Founder @ Studytonight