1. ## Square star pattern

The program will ask the number for length and width then print it into a square star pattern.
Ex. If the user inputted 6 for length and 4 for width
******
* abcd*
* abcd*
******

The abcd indicates a space.

Here is my code so far its not yet done and there's something really wrong about it so it would be really nice if you could help or guide me. Thank you.

Code:
```#include<stdio.h>

void main(void)
{
int wid, len, x, y, z;

printf("Enter the number for length: ");
scanf("%d", &len);
printf("Enter the number for width: ");
scanf("%d", &wid);

for(x=1;x<=len;x++)
printf("*");

for(y=1;y<=wid-1;y++)
{printf("\n*");

for(z=1;z<=len-2;z++)
printf("s");}

}```

2. That doesn't really look like an attempt at anything. Sit down and think about the problem. Figure out how you would do it, step by step. Then once you have that done, you can go ahead and start to program. You may find some use in reading through Lesson 3:Loops

3. One thing that helps when organizing stuff on a display is to think how you would do it on a typewriter ... write it down keystroke by keystroke...

Most often in the process of writing it down, you end up with a codeable solution.

4. I just got it now. Here's my final code.

Code:
```#include<stdio.h>

int main(void)
{
int wid, len, w, x, y, z;

printf("Enter the number for length: ");
scanf("%d", &len);
printf("Enter the number for width: ");
scanf("%d", &wid);

for(x=1;x<=len;x++)
printf("*");

for(y=1;y<=wid-2;y++)
{printf("\n*");
for(z=1;z<=len-2;z++)
printf(" ");
printf("*");}

printf("\n");

for(w=1;w<=len;w++)
printf("*");

return 0;
}```
I'm sure there's a better way to code it but that's all my mind can do for now. Thank you guys. God bless.

5. For that particular problem your solution is as good as any...

Just keep in mind that, during the study/learing phase, it is just as important to work out how to analyse and understand a problem as it is to code a solution.