You're online now.

Hurray! you are online now.

# Stars Square Pattern

Hello Guys. Here will be write a program, the program is how to print the start square pattern and provide the code.

So let's get started code…

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

Step 1: Initialized some variable n, i, j.

• the variable of n stored the value of the size of pattern.
• the variable of i used to iterate the loop.
• the variable of j is used to iterate the second loop.

Here we used to solve this program, used the nested for loop.

Step 2: Print the message for user for take the input by user.

Step 3: Take the input with from user with the help of scanf library function.

Step 4: Start the for loop from 1 to given number by user ‘n’. While this loop condition is true the go through the nested for loop.

Step 5: After print the full line of start then print the new line by “\n”.

Step 6: Exit.

🖤 0