C Program to print Solid Square in a star pattern
Program
/* Solid Square */
#include <stdio.h>
void main()
{
int i, j, n;
printf("Enter number of rows:\t");
scanf("%d", &n);
for(i = 0; i <= n - 1; i++)
{
for(j = 0; j <= n - 1; j++)
{
printf("* ");
}
printf("\n");
}
}
Output
Enter number of rows: 6
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *