Hollow Square Pattern
Here you will learn to print a Hollow Square Star Pattern in C programming language.
Hollow square pattern program code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> int main() { int i,j,num; printf("Enter a Number to print Square Pattern : "); scanf("%d",&num); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { if (i > 0 && i < num - 1 && j > 0 && j < num - 1) { printf(" "); } else { printf("* "); } } printf("\n"); } return 0; } |
Output