C Program to print Hollow Square Pattern for n number of lines.[Pattern 23]| Using C language| C Program series 44|
👨💻C Program to print Hollow Square for n number of lines.[Pattern:23]
Code :
For n number of LINES:
/*
C Program to print Hollow Square Pattern for n number of lines.[Pattern 23]
For Example:n=5
# # # # #
# #
# #
# #
# # # # #
*/
#include<stdio.h>
main()
{
printf("C Program to print Hollow Square Pattern for n number of lines.[Pattern 23]\n\n");
int i,j,n;
printf("Enter the number of lines:");
scanf("%d",&n);
printf("==> Hollow Square Patter.\n");
for(i=1;i<=n;i++)
{
printf("\n\t");//here, '\t' used to shift pattern 1 tab space right side
for(j=1;j<=n;j++)
{
if(i==1||i==n||j==1||j==n)
{
printf("# ");
}
else
{
printf(" ");
}
}
}
printf("\n");
}
The output of Code:

![C Program to print Hollow Square Pattern for n number of lines.[Pattern 23]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixRaJZu-dgwQKqkdKJeVEF5zUrrGf0zySuS-eZ1C03cUzw1SIl1c8Ixgl_IKrR8a397IHWL4lNl5rGoXFrrOlCb3NB-E08VS6qFPqfzlAL7OmzuHp3imCfAL_P9krgnPBJQR1uM0hP5mN5JSbrIgJyJffiUmM1OkZqZr4TXbP2r_ca88nozPoBENM/w640-h212/Screenshot%202022-11-16%20172058.jpg)
![C Program to print Hollow Square Pattern for n number of lines.[Pattern 23]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi68cL7pjmMq2t9ozy4eQ-PC_8yQcgL11NAPAH5e4lTqWtqQLcdEyOyBpvD-QmO4gBjgYVxogks1v-mzZEHPpOgQ6YNRVSOw892H91s6Lj_VnrEM1ShNBjm9g9b-nJfELZBiFtrWVnmwuNKNm8BIChuHnwPIupX4i4EwBZCrdqCy1F83pkSeqaRgbc/w640-h298/Screenshot%202022-11-16%20172123.jpg)
Comments
Post a Comment