প্রোগ্রামের বিবরণ
জ্যামিতিতে, একটি বর্গ হল একটি নিয়মিত চতুর্ভুজ, যার মানে হল চারটি সমান বাহু এবং চারটি সমান কোণ৷
সলিড এবং হোলো স্কোয়ার নীচে দেখানো হিসাবে প্রদর্শিত হবে

অ্যালগরিদম
সলিড স্কোয়ারের জন্য -
Accept the Number of Rows from the user to draw the Solid Square For each Row, Print * for each Column to draw the Solid Square
ফাঁপা বর্গক্ষেত্রের জন্য -
Accept the Number of Rows from the user to draw the Hollow Square For the First and Last Row, Print * for each Column For the Remaining Rows, Print * for the first and Last Column.
উদাহরণ
/* Program to print hollow and Solid Square pattern */
#include <stdio.h>
int main(){
int r, c, rows; //Hollow Rhombus
int r1,c1, rows1; //Solid Rhombus
clrscr();
/* Hollow Square */
printf("Enter the Number of rows for Hollow Square: ");
scanf("%d", &rows);
printf("\n");
for (r=1; r<=rows; r++){
if (r==1 || r==rows){
for (c=1; c<=rows; c++){
printf("*");
}
}
else{
for (c=1; c<=rows; c++){
if (c==1 || c==rows){
printf("*");
}
else{
printf(" ");
}
}
}
printf("\n");
}
printf("\n");
/* Solid Square */
printf("Enter the Number of rows for Solid Square: ");
scanf("%d", &rows1);
printf("\n");
for (r1=1; r1<=rows1; r1++){
for (c1=1; c1<=rows1; c1++){
printf("*");
}
printf("\n");
}
getch();
return 0;
} আউটপুট
