After learning the basics of the C Programming, let's play with the language and code some patterns. To able to code the patterns, you need to have proper knowledge ie. working of the loops, basically nesting of loops. Patterns are generated with the help of the loops.
Let's revise the nesting of loops. So to create the pattern we need rows and columns. For rows and columns, we need two loops ie. one for changing the rows and other for changing the column.
Suppose, you need to create in 5x5 then you need to set the loop counter to 1 and run till greater than or equal to 5. Let's see the codes for it.
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}