C Exercises: Reads the side of a square and prints a hollow square using hash (#) character
Print a hollow square of size nnn using #
Write a C program that reads the side (side sizes between 1 and 10 ) of a square and prints a hollow square using the hash (#) character.
Sample Input: 10
Sample Solution:
C Code:
Sample Output:
Input the size of the square: ########## # # # # # # # # # # # # # # # # ##########
Pictorial Presentation:
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to print a hollow square pattern of a given size, ensuring only the borders are printed.
- Write a C program to generate a hollow square with alternating border characters using loops.
- Write a C program to print a hollow square pattern and replace the diagonal with a different character.
- Write a C program to draw a hollow square by calculating and printing the appropriate spaces and hash symbols.
C programming Code Editor:
Previous:Write a C program that reads the side (side sizes between 1 and 10 ) of a square and prints square using hash (#) character.
Next: Write a C program that reads in a five-digit integer and determines whether or not it’s a palindrome.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.